When One user A log In and then Log out. Then user B logs In. The notification intended for user A is received bu user B because the token generated for user A is not removed. The dart package have no options for removing this token.
FirebaseMessaging _firebaseMessaging = new FirebaseMessaging(); _firebaseMessaging. configure( onMessage: (Map<String, dynamic> message) { }, onResume: (Map<String, dynamic> message) { }, onLaunch: (Map<String, dynamic> message) { }, ); _firebaseMessaging. getToken(). then((token) { saveToken(token); });
Access the registration token To retrieve the current registration token for an app instance, call getToken() . If notification permission has not been granted, this method will ask the user for notification permissions.
Firebase ID tokens are short lived and last for an hour; the refresh token can be used to retrieve new ID tokens. Refresh tokens expire only when one of the following occurs: The user is deleted. The user is disabled.
You can accomplish that by calling deleteInstanceID. Be aware that deleteInstanceID automatically recreates the token, so you have to setAutoInitEnabled to false beforehand. You can check the current auto-init value by querying autoInitEnabled.
Note: requires firebase_messaging version 2.1.0 or greater.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With