Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

FirebaseInstanceIdService is deprecated and OnNewToken() not working

$
0
0

I want to implement OnNewToken() method from FirebaseMessagingService in my Xamarin Android project that uses Firebase Cloud Messaging since FirebaseInstanceIdService and OnTokenRefreshed() are deprecated.

I tried this

[Service]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class MessagingService : FirebaseMessagingService
{
    const string TAG = "MyFirebaseMsgService";
    public override void OnNewToken(string token)
    {
        Log.Debug(TAG, "Refreshed token: " + token);
        SendRegistrationToServer(token);
    }

    public void SendRegistrationToServer(string token)
    {
        ...
    }

}

But my OnNewToken() is not hit. What am I doing wroing. Do i need to include anything in my Android manifest file? I cannot find any documents specific to Xamarin Android about this update. Please help. Thank you so much.


Viewing all articles
Browse latest Browse all 204402

Trending Articles