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:
- https://salesforce-marketingcloud.github.io/JB4A-SDK-Android/create-apps/create-apps-overview.html
- https://help.salesforce.com/articleView?id=mc_mp_provisioning_info.htm&type=5
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