-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
-
IR281 - Push/FCM/Xamarin
In FCM 'InstanceIDListenerService ' are optional. But for sending tokens to UPS we do continue to use this. The following updates are needed:
1) AndroidManifest update
Before:
<service android:name=".MyInstanceIDListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.gms.iid.InstanceID" /> </intent-filter> </service>
After:
<service android:name=".MyInstanceIDListenerService"> <intent-filter> <action android:name="com.google.firebase.INSTANCEID_EVENT" /> </intent-filter> </service>
2) the '' needs to extend 'FirebaseInstanceIdService', and change its 'onTokenRefresh()' method, like:
public class UnifiedPushInstanceIDListenerService extends FirebaseInstanceIdService { ... public void onTokenRefresh() { ... String refreshedToken = FirebaseInstanceId.getInstance().getToken(); .....
We no longer need to explicitly initiate the generation of a registration token — the library does this automatically. Therefore, you can remove code like the following:
https://github.com/aerogear/aerogear-android-push/blob/3.0.1/aerogear-android-push/src/main/java/org/jboss/aerogear/android/unifiedpush/gcm/UnifiedPushInstanceIDListenerService.java#L86-L88
More details are here:
https://developers.google.com/cloud-messaging/android/android-migrate-fcm#migrate_your_listener_service