2

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)
  • I was also stuck at this same error but thanks for your post. It helped me out, however I am facing one issue if you can help. I getting this error TAG variable not found in line Log.e(cv.TAG, e.getMessage()); – Karthik Nagaraj Oct 17 '16 at 12:21
  • If I am understanding correctly, you are saying that the TAG variable is not found? If so, you'll need to define the TAG variable somewhere in your activity like this: private static final String TAG = "MyActivity"; then you can use it like this: Log.e(TAG, e.getMessage()); – MalcolmMcFly Oct 17 '16 at 12:31
1

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

  • Thank @Bill, I'm going to run through the steps again. I've tried putting in the FCM Sender ID where the getting started guide asks for the GCM Sender ID with no luck. Will update my findings here. – MalcolmMcFly Aug 24 '16 at 15:37
  • The ID is just the Project ID for your Google Project. Please post your findings if they are different :) – Bill Mote Aug 24 '16 at 18:59
  • See update @BillMote – MalcolmMcFly Aug 25 '16 at 18:10
  • That is a well documented error regarding Google Play Services and the Support Library incompatibility and is unrelated to our SDK. See related answers stackoverflow.com/questions/37312340/… – Bill Mote Aug 25 '16 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.