Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.78 KB

migration-guide-fcm.md

File metadata and controls

50 lines (37 loc) · 1.78 KB

FCM Migration

FCM migration is optional, but recommended as Google deprecated GCM and is planning on dropping GCM client APIs in April of 2019. For more info, please read the GCM F.A.Q.

Urban Airship supports the FCM client library starting in SDK 9.1.0. It is available in a new package urbanairship-fcm. The FCM package is not compatible with the deprecated package urbanairship-sdk and urbanairship-gcm.

Migration Steps:

   dependencies {
     ...

     // Urban Airship SDK - FCM
     implementation 'com.urbanairship.android:urbanairship-fcm:9.1.0'
     implementation 'com.google.firebase:firebase-messaging:15.0.0'

     // Urban Airship SDK - ADM (Optional - if you support ADM)
     implementation 'com.urbanairship.android:urbanairship-adm:9.1.0'
   }
  • If your application uses its own FirebaseMessagingService, FirebaseInstanceIDService, or another provider that uses FCM, you will need to forward token refresh and message received calls to the Urban Airship SDK:
// FirebaseInstanceIdService:

public void onTokenRefresh() {
   // Notify Urban Airship that the token is refreshed.
   AirshipFirebaseInstanceIdService.processTokenRefresh(getContext());
}
// FirebaseMessagingService:

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
   AirshipFirebaseMessagingService.processMessageSync(getContext(), remoteMessage);
}