I have implemented the React Native SDK and I am successfully receiving push notifications on both platforms.
The problem I am having is that, on Android only, the notification builder seems to be ignoring all customisation I am passing. It shows only the default icon and notification title. I need the notification to show the content as well, including images - and it would be nice to show the correct icon too. It even seems to ignore custom notification channel IDs that I pass into it, and always defaults to a standard 'channel_01'.
I've tried basically everything at this stage but to no avail. My (current) init code, with the builder, looks like this:
MarketingCloudSdk.init(this,
MarketingCloudConfig.builder()
.setApplicationId(getString(R.string.salesforce_application_id))
.setAccessToken(getString(R.string.salesforce_token))
.setSenderId(getString(R.string.salesforce_sender_id))
.setMarketingCloudServerUrl(getString(R.string.salesforce_mc_app_endpoint))
.setNotificationCustomizationOptions(
NotificationCustomizationOptions.create((context, notificationMessage) -> {
NotificationCompat.Builder builder = NotificationManager.getDefaultNotificationBuilder(
context,
notificationMessage,
NotificationManager.createDefaultNotificationChannel(context),
R.mipmap.ic_small_icon
);
builder.setContentText(notificationMessage.alert());
String customUrl = notificationMessage.url();
Intent intent = new Intent(context, MainActivity.class);
intent.setData(Uri.parse(customUrl));
builder.setContentIntent(
NotificationManager.redirectIntentForAnalytics(
context,
PendingIntent.getActivity(
context,
100,
intent,
PendingIntent.FLAG_IMMUTABLE
),
notificationMessage,
true
)
);
return builder;
})
)
.build(this),
initializationStatus -> Log.e("INIT", initializationStatus.toString()));
I have also tried passing just the icon in the most basic setup as shown in the SDK docs (without providing a builder or any customisation) but the outcome is always the same - the notification displays only a title and the app icon, rather than the one I am providing.
As we are using another push library in the app, we also must include the Firebase messaging SDK, so I have extended this like so:
class MessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
super.onNewToken(token)
// Marketing cloud SDK
MarketingCloudSdk.requestSdk { it.pushMessageManager.setPushToken(token) }
}
override fun onMessageReceived(message: RemoteMessage) {
if (PushMessageManager.isMarketingCloudPush(message)) {
MarketingCloudSdk.requestSdk { it.pushMessageManager.handleMessage(message) }
} else {
//Not from Marketing Cloud. Must handle yourself.
super.onMessageReceived(message)
}
}
}
Note that all other pushes, from FCM or other providers, are working as expected. This issue is only happening with pushes delivered from SFMC.
If anyone can tell me where I might be going wrong I'd really appreciate it as I've been banging my head against this wall for almost a week now and haven't made any progress!
Edit: As mentioned in a response below - I cannot remove the senderId as this breaks the implementation. Doing so results in no session token being associated with my user.
Thanks, Dan