So now that the FirebaseInstanceIdService service is deprecated I\'m unsure what to replace it with.
I previously had a service declared in the manifest like so:
Check this topic:
FirebaseInstanceIdService is deprecated
You have to replace it with:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onNewToken(String s) {
super.onNewToken(s);
Log.e("NEW_TOKEN",s);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
}
}
And in manifest:
And if you want to get token somewhere in your project:
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener( MyActivity.this, new OnSuccessListener() {
@Override
public void onSuccess(InstanceIdResult instanceIdResult) {
String newToken = instanceIdResult.getToken();
Log.e("newToken",newToken);
}
});
There is no need to use
Hope it helps you