Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-3769

Migrate UnifiedPushInstanceIDListenerService to FCM

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • None
    • None
    • push

    Description

      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

      Attachments

        Activity

          People

            supittma@redhat.com Summers Pittman (Inactive)
            mwessend@redhat.com Matthias Wessendorf
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: