Context:
Implementing Cloud Push Notifications on Android via Parse Server
as Backend and Firebase Cloud
Messaging Service
Just to add to Md. Asaduzzaman's answer, make sure to override the onNewToken() method in your custom FirebaseMessagingService, like in this tutorial. (I just found the tutorial and thought it would be nice to share it if others are stuck with the same problem).
@Override
public void onNewToken(String s) {
super.onNewToken(s);
Log.i("NEW_TOKEN", s);
}
We need to override it because:
"FirebaseInstanceIdService: This class was deprecated. In favour of overriding onNewToken in FirebaseMessagingService.
Once that has been implemented, this service can be safely removed."
FirebaseInstanceIdService
is no longer usable. Use latest version of parse and FirebaseMessagingService
implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.21.0"
And use ParseFirebaseMessagingService
<service
android:name="com.parse.fcm.ParseFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>