3

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 with 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?

Louie
  • 5,920
  • 5
  • 31
  • 45

1 Answers1

3

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.

Patrick Perini
  • 22,555
  • 12
  • 59
  • 88
  • So how does Apple do it? (http://stackoverflow.com/questions/14399781/image-previews-in-notification-center) –  Aug 13 '13 at 09:27
  • @MachOSX They just displaying the app icon from your Bundle that you supplied while uploading the app. – Siba Prasad Hota Jul 07 '14 at 12:10
  • @AmolPrakash Looks like there's an associated passbook pass that iOS independently displays. That's iOS deep-linking, not image inclusion in a notification. – Patrick Perini Jul 24 '15 at 16:45