Add Image to Push Notification
Is there an easy way to add an image to push notifications? I cant seem to find a suitable post here about it.
Can I intercept the message before displaying the notification so I can look at the string and look for an image url? And then strip the message of the url.
Such as "This is my push message wit开发者_Python百科h an image attached :AI:image.jpg" But only display the message "This is my push message with an image attached"
If I see the string contains " :AI: " i know to look at a specified folder for the image name and then pull it down from my server. IE http://myserver/StaticFolderThatDoesntChange/image.jpg
Hope this makes sense?
Push notifications do not reference your app before being received and displayed, so no- you can't intercept them. You also cannot properly include an image. At best, only the string name of an image can be sent via a Push Notification.
Push Notifications are almost entirely autonomous from your app, and are encoded in JSON, which does not support raw binary data or image objects.
精彩评论