2
Reply

Firebase onTokenRefresh() is not called

arvind baldaniya

arvind baldaniya

Mar 3 2017 12:42 AM
1.5k
I can see the token using FirebaseInstanceId.Instance.Token and it display the generated token. But it seems like in my MyFirebaseInstanceIDService where it is extends to FirebaseInstanceIdService, the onTokenRefresh() is not called, where in this function it was said that the token is initially generated here. I needed to call sendRegistrationToServer() that's why I'm trying to know why it doesn't go in the onTokenRefresh(). but when i am uninstalling the appliction and installing again then it works fine, but it is not proper way to uninstall every time 
 
 
 
My Code
 
[Service]
[IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
public class ZFFirebaseIIDService : FirebaseInstanceIdService
{
const string TAG = "MyFirebaseIIDService";
public override void OnTokenRefresh()
{
var refreshedToken = FirebaseInstanceId.Instance.Token;
Log.Debug(TAG, "Refreshed token: " + refreshedToken);
SendRegistrationToServer(refreshedToken);
}
 

Upload Source Code  Select only zip and rar file.
Answers (2)