How can I send an Android notification with a picture?

On Jelly Bean (4.1) and beyond, Push Notifications to Android devices now have the functionality to send notifications with images. This feature is called Big Picture

Do I need to do any extra integration to use Big Picture?

No. If the Urban Airship Android SDK is successfully integrated, the app can receive Big Picture notifications. 

How do I send a Big Picture notification?

There are two ways to add media to your push notifications.

Option 1: Include a URL to your own hosted media (be sure to use an https link).

Option 2: If you use Urban Airship’s Content Delivery Network (CDN) Media Hosting, you may click the upload button and select an Urban Airship hosted media file. (Read about why you should consider using a CDN here.)

Example API request for a Big Picture notification

Below is an example API request template. Replace the fields marked [***LIKE THIS***] with your own values. 

curl https://go.urbanairship.com/api/push/ \
-X POST \
-u "[***AUTHORIZATION STRING***]" \
-H "Content-type: application/json" \
-H "Accept: application/vnd.urbanairship+json; version=3;" \
--data '{"audience": "all",
"device_types": "all",
"notification":
{"alert": "[***GENERAL ALERT MESSAGE***]",
"android": {
"style": {
"type": "big_picture",
"big_picture": "[***FULL IMAGE URL***]",
"title": "[***BIG PICTURE TITLE***]",
"summary": "[***BIG PICTURE SUMMARY***]"
}}}}'

 

How do I get the image to fit on the notification?

Android devices differ greatly in screen size and ratio, so choosing the right image can be tricky. 

When creating an image to send, it is more important to choose a suitable aspect ratio than a specific resolution size.


The Big Picture feature works by adjusting images uniformly so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view. 

More information is available in the release notes from Google. Google recommends using an image with an aspect ratio of approximately 2:1.

To ensure that no important information is cut from an image, make sure that the important information is focused in the center and not around the edges. 

Below are some suggested dimensions based on the most common Android device resolutions: 

  • Small - 512x256
  • Medium - 1024x512
  • Large - 2048x1024

 

Related Content

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Submit a request