FirebaseInstanceIdService is deprecated
firebaser here
Check the reference documentation for FirebaseInstanceIdService
:
This class was deprecated.
In favour of overriding
onNewToken
inFirebaseMessagingService
. Once that has been implemented, this service can be safely removed.
Weirdly enough the JavaDoc for FirebaseMessagingService
doesn't mention the onNewToken
method yet. It looks like not all updated documentation has been published yet. I've filed an internal issue to get the updates to the reference docs published, and to get the samples in the guide updated too.
In the meantime both the old/deprecated calls, and the new ones should work. If you're having trouble with either, post the code and I'll have a look.
What is an alternative to the deprecated FirebaseInstanceIdService and OnTokenRefresh?
as FirebaseInstanceId is depreciated you could use
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
System.out.println("Token : "+ task.getResult());
});
Warning CS0618: 'FirebaseInstanceIdService' is obsolete: 'This class is obsoleted in this android platform
When you update to Xamarin.Firebase.Messaging version 71.1740.0 then you start to get compiler warnings about deprecated methods due to changes in the Google libraries. You no longer need FirebaseInstanceIdService
so go ahead and remove that. Now you get the device token from your FirebaseMessagingService.OnNewToken
method.
Related Topics
How to Check Visibility of Software Keyboard in Android
Android "Only the Original Thread That Created a View Hierarchy Can Touch Its Views."
Detect Whether There Is an Internet Connection Available on Android
Android: View.Setid(Int Id) Programmatically - How to Avoid Id Conflicts
How to Filter a Recyclerview With a Searchview
Fullscreen Activity in Android
Static Way to Get 'Context' in Android
Android Studio: Add Jar as Library
How to Add Parameters to Httpurlconnection Using Post Using Namevaluepair
Firebase Android: Make Username Unique
How to Convert a Drawable to a Bitmap
How to Stop Edittext from Gaining Focus When an Activity Starts in Android
Using the Android Application Class to Persist Data
Removing an Activity from the History Stack
Android Activity Life Cycle - What Are All These Methods For