FirebaseInstanceIdService is deprecated

  • A+
Category:Languages

Hope all of you aware of this class, used to get notification token whenever firebase notification token got refreshed we get the refreshed token from this class, From following method.

@Override public void onTokenRefresh() {     // Get updated InstanceID token.     String refreshedToken = FirebaseInstanceId.getInstance().getToken();     Log.d(TAG, "Refreshed token: " + refreshedToken); } 

To use this as i want to implement FCM, I extended MyClass from FirebaseInstanceIdService

But, Showing that FirebaseInstanceIdService is deprecated

Does anybody know this?, What method or class i should use instead of this to get refreshed token as this is deprecated.

I'm using : implementation 'com.google.firebase:firebase-messaging:17.1.0'

I checked the document for same there is nothing mentioned about this. : FCM SETUP DOCUMENT

Any help will be appreciated.

 


Check the reference documentation for FirebaseInstanceIdService:

This class was deprecated.

In favour of overriding onNewToken in FirebaseMessagingService. Once that has been implemented, this service can be safely removed.

Weirdly enough the JavaDoc for FirebaseMessagingService doesn't mention the onNewToken method yet. Be sure to check if it exists though, it might be that the documentation wasn't updated.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: