[SalesForce] Integrate the Marketing Cloud Mobile Push Android SDK with FCM

Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits the reliable and scalable GCM infrastructure, and today if you are integrating messaging in a new app, you are forced to go with FCM.

The latest documentation for integrating the Marketing Cloud Mobile Push Android SDK on Android shows the directions for GCM.

http://salesforce-marketingcloud.github.io/JB4A-SDK-Android/sdk-implementation/implement-sdk-google.html

Is there an updated guide to integrating the Marketing Cloud Mobile Push Android SDK with FCM? What is the difference in the implementation?

UPDATE 1

Carefully went through the steps from the getting started guide again. I am getting the same error as before. Here is what my application class looks like:

// Key Imports

import com.exacttarget.etpushsdk.ETException;
import com.exacttarget.etpushsdk.ETPush;
import com.exacttarget.etpushsdk.ETPushConfig;
import com.exacttarget.etpushsdk.ETPushConfigureSdkListener;
import com.exacttarget.etpushsdk.ETRequestStatus;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;

// onCreate()

@Override
public void onCreate() {
    super.onCreate();
    initFabric();
    initDagger();
    registerActivityLifecycleCallbacks(new MainActivity3());

    /** Register to receive push notifications. */
    try {
        ETPush.configureSdk(new ETPushConfig.Builder(this)
                        .setEtAppId(ET_APP_ID)
                        .setAccessToken(ET_ACCESS_TOKEN)
                        .setGcmSenderId(FCM_SENDER_ID)
                        .setAnalyticsEnabled(false)    // ET Analytics, default = false
                        .setWamaEnabled(false)         // Web & Mobile Analytics, default = false
                        .build()
                , new ETPushConfigureSdkListener() {
                    @Override
                    public void onETPushConfigurationSuccess(ETPush etPush, ETRequestStatus etRequestStatus) {
                        // Verify Google Play Services availability and notify the user of any exceptions
                        if (etRequestStatus.getGooglePlayServiceStatusCode() != ConnectionResult.SUCCESS && GoogleApiAvailability.getInstance().isUserResolvableError(etRequestStatus.getGooglePlayServiceStatusCode())) {
                            GoogleApiAvailability.getInstance().showErrorNotification(getApplicationContext(), etRequestStatus.getGooglePlayServiceStatusCode());
                        }

                        // Add attributes, tags, set subscriber key, etc.
                        try {
                            etPush.addAttribute("someKey", "someValue");
                            etPush.addTag("someTag");
                            // etc ...
                        } catch (ETException e) {
                            Crashlytics.log(Log.ERROR, "onetech", e.getMessage());                            }
                    }

                    @Override
                    public void onETPushConfigurationFailed(ETException e) {
                        // If we're here then your application will _NOT_ receive push notifications.
                        Crashlytics.log(Log.ERROR, "onetech", e.getMessage());                        }
                }
        );
    } catch (ETException e) {
        Crashlytics.log(Log.ERROR, "onetech", e.getMessage());        }
}

Error:

E: FATAL EXCEPTION: Thread-539
Process: com.package.name, PID: 27776
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
   at com.google.android.gms.iid.zzd.zzeC(Unknown Source)
   at com.google.android.gms.iid.zzd.<init>(Unknown Source)
   at com.google.android.gms.iid.zzd.<init>(Unknown Source)
   at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
   at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
   at com.exacttarget.etpushsdk.af.run(SourceFile:1878)
   at java.lang.Thread.run(Thread.java:818)

Best Answer

No change is currently required for your implementation of the Marketing Cloud Mobile Push SDK and the documentation is accurate.

Related Topic