2
.setNotificationBuilder((context, notificationMessage) -> {

    NotificationCompat.Builder notificationBuilder = NotificationManager.setupNotificationBuilder(context, notificationMessage);
    notificationBuilder.setContentTitle(Html.fromHtml(notificationMessage.title()).toString()));

    return notificationBuilder;

I'm trying to decode html encoding being sent in the title, but its not being changed at all. While debugging it can be seen that the notifcation builder's content has changed, it still doesn't reflect on the notification itself.

  • What is the reason your title text is html encoded? Is it to impose so sort of formatting requirements? Can you provide an example of the title text you're expecting and the html you're sending? – Seth Jan 12 '18 at 19:12
  • So html isn't being sent. From ExactTarget we are sending messages that contain special characters. ExactTarget is encoding them. I can't find a way to make ExactTarget ( MobilePush ) not change the apostrophe to something else, so now I'm going to grab the message in the notification builder and decode that. but the SDK doesn't make any changes. – prometheuspk Jan 12 '18 at 21:35
  • 1
    There isn't really anything that the SDK is doing here. You're setting a title in the Android's notification builder. Since you're overriding the notification builder the SDK will do nothing else with that builder before handing it off the Android's NotificationManager. Can you share an example of the encoding that is being sent? – Seth Jan 12 '18 at 22:22
  • > There isn't really anything that the SDK is doing here But this method is supposed to modify the notification builder. its not doing that at all. – prometheuspk Jan 15 '18 at 15:15
  • Testin' Search turns into Testin' Search – prometheuspk Jan 15 '18 at 15:18
2

Two things are at play here.

First off, the fact that your title is arriving on the device with the apostrophe escaped is a bug in the Marketing Cloud UI that has been fixed, but not released.

Second thing is with regards to the Notification.Builder. The reason you're not seeing the title change when you use the setContentTitle method on the builder is because you've used the setupNotificationBuilder method to allow the SDK to create and populate the builder for you. setupNotificationBuilder sets a style on the notification to be NotificationCompat.BigTextStyle*. When this style is used the alert body and title are taken from what was set on that style when it was set. If you don't use setupNotificationBuilder and create/populate the Notification.Builder then you'll see the result you're looking for.

Additionally, you could use setupNotificationBuilder set your modified title and also set the style to null. This worked in my limited testing, but I'm not sure if there would be any side effects from doing this.

*If there is an image in the notification the style will instead be set to Notification.BigPictureStyle

Updated 4/23/18: With the release 213 Marketing Cloud release (today), the bug with apostrophe encoding has been corrected.

  • Is there a way to see the bug report ? just so that i know the details of the release. – prometheuspk Jan 15 '18 at 20:50
  • We don't have anything publicly accessible for you to track the release of this bug. The bug only seems to manifest for push messages sent from the Marketing Cloud UI. If you create and send a message via the api then everything works as expected. If that is not an option for you then you'll want to modify your solution in you app to follow one of my original suggestions. – Seth Jan 16 '18 at 12:47

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.