AndroidPub
Published in

AndroidPub

New Way to Implement Firebase Push Notification — FirebaseInstanceIdService Deprecated (Android)

New versions + New Implementation = Easiness

Credits
com.google.firebase.INSTANCE_ID_EVENTcom.google.firebase.MESSAGING_EVENT
@Override
public void onNewToken(String s) {
super.onNewToken(s);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
}

Visit my website at https://danishamjad.com/

<service
android:name=".service.firebase.MyInstanceIDListenerService"
android:permission="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
FirebaseInstanceId.getInstance().getToken()
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListenr(Activity.this,new OnSuccessListener<InstanceIdResult>() {
@Override
public void onSuccess(InstanceIdResult instanceIdResult) {
String newToken = instanceIdResult.getToken();
}
});

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Danish Amjad

Senior Mobile Engineer (Android). Open Source Contributor, Technical Writer, Email: Dani.amjad12@gmail.com check my website at https://danishamjad.com/