Notification Images Not Showing

Notifications images not appearing.

When sending notifications that include images, the OneSignal SDK tries to get the external image URLs from the OSNotification Payload and display it within the notification. It doesn't matter if the app is closed during this process. The SDK waits for the images to be downloaded, but if there's a network issue or it takes longer than 30 seconds (enforced by Apple), the notification is displayed without the image.

The most common reasons for images not showing are:

  • Redirects and URLs without image file extensions and https protocols (http URLs do not work for most apps as iOS and Android require all network requests to be https by default)
  • Unstable network connections on the device or the image server not being able to handle the required bandwidth

If the image fails to download, OneSignal's SDK does not retry to get the image again. Using the SDK setLogLevel method with WARN or VERBOSE logging, you can see the specific errors related to image downloading, such as:

  • Could not download image!
  • Encountered an error while attempting to download file with URL:
  • OneSignal encountered an exception while downloading file

Below are common solutions to check if you do not see your notification images:

Image Size

Try decreasing the Image File size by lowering the quality and/or the image size to the recommended settings.

Image URL

Image URLs need a direct link to the image, no redirects allowed. Redirects and URLs without the proper http or https protocol provided and image extension will not work.
In most cases, a direct link will have a file extension like .png or .jpg

Example:

  • this will not work: https://pixabay.com/en/architecture-travel-sky-building-3095716/

  • But if you right click the image and open in a new tab, this will work:
    https://cdn.pixabay.com/photo/2018/01/21/01/46/architecture-3095716_960_720.jpg

Image Host

The server hosting the image may have went down or could not handle the amount of downloads. Around 30 seconds is how long the device has to download all notification resources, including images. If it takes longer, it will not show on that device.

Try hosting the resource on a dedicated server or use the OneSignal import option to have us host it for you.

🚧

Media Upload Limitations

OneSignal only stores images uploaded to our servers for 33 days from the time it was uploaded.

If you duplicate or use a draft message with an image uploaded longer than 33 days, you will need to re-upload the image.

If you need the image for longer, you can use templates or store the image on your own servers and reference the resource URL directly.

Web Push Images

Only Chrome supports large images in push notifications on Windows, Android and macOS running Big Sur.

Firefox, Safari and Edge do not support big images.

On mobile web push, when you get the notification in the android device shade, you will need to slide down on the notification to see the image.

If your mobile browser app has many unread push notifications and/or many tabs open, this can cause notifications to now show.

iOS Push Images

Not seeing Rich Media on iOS notifications generally happens when the Notification Service Extension for your app is not setup. Please double check the setup docs you used for the iOS Notification Service Extension that it was implemented correctly.

  1. Test another device, if the image shows, then the Notification Service Extension is setup correctly. Details on Troubleshooting the iOS Notification Service Extension

  2. Open your attachment URL in a web browser. Make sure it is a direct link to the image/video, it cannot be part of an HTML page. Also redirects are not supported.

  3. If it takes more than 30 seconds to download the attachment, iOS will cancel the extension service and the notification will be displayed without media. Check to make sure the size of your attachment is appropriate. You can see a list of supported media (and max file sizes) here.

  4. Make sure your URL is HTTPS. HTTP urls will not work unless you set NSAppTransportSecurity to NSAllowsArbitraryLoads in your Xcode .plist.

❗️

About App Transport Security

Please do not leave NSAllowsArbitraryLoads enabled when releasing your app to the App Store, as this can create a security vulnerability in your app. For more information, please read Apple's Security Overview

  1. There was a networking issue with the device or server where the media is hosted. Try hosting the image on OneSignal or another hosting provider.

  2. Check your OneSignalNotificationServiceExtension's Deployment Target, and set it to iOS 10.

Android Push Images

When you get the notification in the android device shade, you will need to slide down on the notification you should see it