1

Due to the April 11 deprecation of GCM client and the deprecation of SDK versions below 6.x.x of Mobile Marketing Cloud SDK, we're migrating our SDK versions. I'm having trouble implementing and testing a migration from MMCSDK v5.6.2 to v6.1.0

I followed the migration/implementation guide here:

With v5.6.2, we were already using Firebase and had setup our apps on the Marketing Cloud Console following these instructions:

Builds made with v5.6.2 receive push notifications from marketing cloud successfully.

As can be seen from the logs, we're initializing okay but we're still not getting a push notification when testing in our stage or prod environment.

The following code is executed in our application class to initialize the MarketingCloudSdk:

MarketingCloudSdk.init(applicationContext, MarketingCloudConfig.builder()
            .setApplicationId(BuildConfig.MARKETING_CLOUD_APP_ID)
            .setAccessToken(BuildConfig.MARKETING_CLOUD_TOKEN)
            .setSenderId(BuildConfig.FCM_SENDER_ID)
            .setMarketingCloudServerUrl(BuildConfig.MARKETING_CLOUD_SERVER_URL)
            .setMid(BuildConfig.MARKETING_CLOUD_MID)
            .setAnalyticsEnabled(true)
            .setNotificationCustomizationOptions(
                    NotificationCustomizationOptions.create(R.drawable.ic_notification_symbol,
                            (context, notificationMessage) -> {
                                int requestCode = new Random().nextInt();
                                String url = notificationMessage.url();
                                PendingIntent pendingIntent;
                                if (TextUtils.isEmpty(url)) {
                                    pendingIntent = PendingIntent.getActivity(
                                            context,
                                            requestCode,
                                            new Intent(context, StartUpActivity.class),
                                            PendingIntent.FLAG_UPDATE_CURRENT
                                    );
                                } else {
                                    pendingIntent = PendingIntent.getActivity(
                                            context,
                                            requestCode,
                                            new Intent(Intent.ACTION_VIEW, Uri.parse(url)),
                                            PendingIntent.FLAG_UPDATE_CURRENT
                                    );
                                }
                                return NotificationManager.redirectIntentForAnalytics(context, pendingIntent, notificationMessage, true);
                            }, (context, notificationMessage) -> {
                                if (TextUtils.isEmpty(notificationMessage.url())) {
                                    return NotificationManager.createDefaultNotificationChannel(context);
                                } else {
                                    return MARKETING_CLOUD_NOTIFICATION_CHANNEL_NAME;
                                }
                            }))
            .build(applicationContext), initializationStatus -> {
                if (initializationStatus.isUsable()) {
                    if (initializationStatus.status() == InitializationStatus.Status.COMPLETED_WITH_DEGRADED_FUNCTIONALITY) {
                        /*  While the SDK is usable, something happened during init that you should address.
                            This could include: */
                        if (initializationStatus.locationsError()) {
                            LogUtil.d(TAG, "locationsError");
                            //Google play services encountered a recoverable error
                            GoogleApiAvailability.getInstance()
                                    .showErrorNotification(applicationContext, initializationStatus.playServicesStatus());
                        } else if (initializationStatus.messagingPermissionError()) {
                            LogUtil.d(TAG, "messagingPermissionError");
                            /* The user had previously provided the location permission, but it has now been revoked.
                             Geofence and Beacon messages have been disabled.  You will need to request the location
                             permission again and re-enable Geofence and/or Beacon messaging again. */
                        }
                    }
                } else {
                    //Something went wrong with init that makes the SDK unusable.
                    LogUtil.d(TAG, "Unsuccessfully configured MarketingCloud");
                }
            });

Relevant Dependencies compileSdkVersion = 28 targetSdkVersion = 28 minSdkVersion = 23 supportLibraryVersion = '28.0.0' playServicesVersion = '16.0.0' firebase-core = '15.0.2' also tried the latest '16.0.7' firebase-messaging = '17.4.0' Other services in the app are using this and work fine on our migration branch

Logs with redacted sensitive data initConfig: https://pastebin.com/zx8PheGh Log: https://pastebin.com/7wChxxxB

Questions

  • Is there anything else that may have gone wrong here with our implementation?

  • Is there an example app somewhere with v6.1.0 that we can see

1 Answer 1

1

According to the SDKState output you have multiple FCM messaging service classes registered in your manifest at a higher priority than the one used by the SDK. com.example.login.service.MyFirebaseMessagingService and io.smooch.core.FcmService.

If this is intentional then you need to follow the instructions for implementing multiple push providers in your application http://salesforce-marketingcloud.github.io/JB4A-SDK-Android/trouble-shooting/multiple-push-sdks.html. Otherwise, you can just remove those services from your manifest and the Marketing Cloud SDK will work as expected.

1
  • Thanks this was the problem. We also had these other push services in our build using v5.6.2 and that was able to send the message correctly so we assumed that the code in there was sound as the migration guide had no mention of any changes there.
    – Anthony F
    Mar 14, 2019 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .