I got unregistered registration token even I am sure my token is correct and I check it in my log I am using master token FirebaseInstanceId.Instance.Token
.
Here is my method:
private void ConfigureFireBase()
{
Task.Run(() => {
var instanceId = FirebaseInstanceId.Instance;
Android.Util.Log.Debug("TAG", "{0} {1}", instanceId?.Token?.ToString(), instanceId.GetToken(GetString(Resource.String.gcm_defaultSenderId), Firebase.Messaging.FirebaseMessaging.InstanceIdScope));
});
}
I check as well OnTokenRefresh
method the same token
public override void OnTokenRefresh()
{
var refreshedToken = FirebaseInstanceId.Instance.Token;
Log.Debug(TAG, "Refreshed token: " + refreshedToken);
SendRegistrationToServer(refreshedToken);
}
but when I tried in Firebase console it gives me this error message, when I tried in http://pushtry.com/ with the same token I got not NotRegistered message
Note when I uninstall the app and install again the token working, but after while I got this error message.
The reason why this issue fired cause that token is unregistered
Reference
and this happen in debug mode only so dont worry in release mode every thing will be fine.
How you can fix the issue ?
its easy just force to refresh token call this method in your landing activity (MainActivity , Login ) , this method force firebase to call
OnTokenRefresh()
Hope this help any one face same issue
In my case i had used Emulator and the Firewall was blocking it. I used my mobile, enabled the developer options and it got worked.
Hope this helps.