Questions related to App Notifications

Hi Guys!

We need to implement notifications for application on IOS, Android devices.

For now only simple notifications are shown for both of them.

1) Could you please give examples in Java how can we include media data (image) into payload?

API for IOS doesn't work:

private MediaAttachment getMediaAttachment(PopularContent popularItem) {
return MediaAttachment.newBuilder()
.setUrl(getCDNHost() + popularItem.getSmallImagePath())
.build();
}
private IOSDevicePayload getIOSDevicePayload(PopularContent popularItem) {
return IOSDevicePayload.newBuilder()
.setAlert(popularItem.getShortDescription())
.setTitle(popularItem.getShortTitle())
.setMediaAttachment(getMediaAttachment(popularItem))
.build();
}

And what options should we use for Android?

2) Notifications should expire after some time

Next snippets don't work:

private IOSDevicePayload getIOSDevicePayload(PopularContent popularItem) {
return IOSDevicePayload.newBuilder()
.setAlert(popularItem.getShortDescription())
.setTitle(popularItem.getShortTitle())
.setExpiry(getPushExpiry(EXPIRY_SECONDS))
.build();
}
private AndroidDevicePayload getAndroidDevicePayload(PopularContent popularItem) {
return AndroidDevicePayload.newBuilder()
.setAlert(popularItem.getShortDescription())
.setTitle(popularItem.getShortTitle())
.setTimeToLive(getPushExpiry(EXPIRY_SECONDS)))
.build();
}

 

Please assist.

Thanks,

Nastya

Didn't find what you were looking for?

New post

Comments

2 comments

  • Nastya,

    For the Image payload, can you verify for us that you've implemented the Notification Service Extension for iOS? If you haven't done this yet, you won't be able to receive images, video, or sound on iOS.

    For Android, you won't need a separate extension for this. Instead, you should be sending along only images (Android does not support gifs, sound, or video) using Big Picture. You'll want to use the setContent method under the AndroidDevicePayload.

     

    As for the snippets that did not work, can you elaborate what didn't work? Expiry works only as TTL. So, the push will be dropped if it is unable to be delivered to the device for any reason.

    Comment actions Permalink
    0
  • Nastya,

    You shouldn't need to do any other configurations for your device or for UA to get big picture to work. 

    You will want to make sure you have a relatively up-to-date device that can handle Big Picture mode (Android 4.1 and above supports it). Other than that, make sure that whatever launcher you're using as well supports native Android features like Big Picture. Some Android launchers, especially if it's a custom one, may not handle notifications very well.

    Outside of that, I'm seeing that you sent the URL 

    https://www.example.com/082018-music-nicki-minaj-posts-joe-budden-screenshots.jpg

    I'm assuming in your actual request to your device that that linked to a valid picture, correct?

    Comment actions Permalink
    0

Please sign in to leave a comment.