EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 446 forks source link

Best practice for handling user logout and FCM messages #639

Open Jamie452 opened 6 years ago

Jamie452 commented 6 years ago

I've managed to get an app up and running that uses FCM and firebase auth, both of which are working great.

I'm wondering what the best practice would be to avoid sending FCM's to a device where the user has logged out.

Thought I'd ask if theres some clever mechanism for this already or if my only options are to subscribe/unsubscribe to a topic on login/logout?

SilverHoodCorp commented 6 years ago

Looking for answers to the same question.. Its a disaster this isnt properly documented

EddyVerbruggen commented 6 years ago

Yeah mate a true disaster.

SilverHoodCorp commented 6 years ago

using SharedPrefs to check login state and then show/do operations accordingly.. ? Found this, probably the simplest solution. Haven't tested though.. src: https://stackoverflow.com/questions/47547091/handling-login-logout-on-receiving-fcm