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
Comments
2 comments