1

We can't seem to get Marketing Cloud (MobilePush) to display the icon we've configured it to display on Android. As far as I can tell, we've followed the documentation correctly, but the system default notification icon is still displayed. Using our own custom push notification handling (for handling non-MobilePush push notifications) shows the correct icon, which is using the same drawable resource.

We're using version 8.0.4 of the SDK (com.salesforce.marketingcloud:marketingcloudsdk:8.0.4).

Here's how we've configured the SDK:

Configuring SFMCSdk (stripped for brevity):

val sdkModuleConfig = SFMCSdkModuleConfig.build {
  pushModuleConfig = MarketingCloudConfig.builder()
    .setNotificationCustomizationOptions(
      NotificationCustomizationOptions.create { context, notificationMessage ->
        NotificationManager.getDefaultNotificationBuilder(
          context,
          notificationMessage,
          NotificationManager.createDefaultNotificationChannel(context),
          R.drawable.ic_notification, // <-- this icon is not displayed in notifications
        )
          .setContentIntent(
            NotificationManager.redirectIntentForAnalytics(
              context,
              buildNotificationIntent(notificationMessage.url),
              notificationMessage,
              true, // dismiss after opening
            ),
          )
      },
  )
}

SFMCSdk.configure(application, sdkModuleConfig) {
  // handle initialization status
}

Receiving push notifications:

SFMCSdk.requestSdk { sdk ->
  sdk.mp { mp ->
    mp.pushMessageManager.handleMessage(remoteMessage)
  }
}

Any steps to guide us in the right direction would be appreciated! ☺

2 Answers 2

0

The only thing that can make the icon not display correctly is it being invalid with regards to Google's requirements. See Google's notification icon requirements. Also, search for Android Asset Studio. It's a great tool for creating all sorts of Android assets.

5
  • I don't understand how that could be the case, though, as it's being shown for non-MobilePush push notifications and we're using the exact same asset there through NotificationCompat.Builder#setSmallIcon(R.drawable.ic_notification).
    – sindrenm
    May 15 at 15:27
  • There is no "magic" in the SDK in this regard: builder.setSmallIcon(smallIconResId) and we have thousands of customers using this version with hundreds of millions of installed devices. Check your asset.
    – Bill Mote
    May 16 at 12:28
  • We were using WebP assets. I noticed that your sample application had PNG assets. WebP worked fine through NotificationCompat.Builder, but not with SFMCSdk. Converting those same assets from WebP to PNG worked with MobilePush as well. Are you sure there's no file type check anywhere preventing WebP images from working?
    – sindrenm
    May 25 at 13:07
  • The SDK simply assigns the smallIcon just as you see above.
    – Bill Mote
    May 25 at 14:06
  • 1
    Very strange. We're using NotificationCompat from androidx.core:core-ktx:1.7.0. Perhaps there's a difference there. Either way, it doesn't matter anymore, we converted to a PNG and now it works with both SDKs.
    – sindrenm
    May 25 at 14:17
0

We found that working with WebP assets were the issue, even though WebP is supported by the system. Converting the WebP graphics to PNGs made them appear also using MobilePush.

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.