How can I send a 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?

Right now, Big Picture notifications can only be sent through the Urban Airship API. Please see our documentation on Style for Android Push

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 the important information is focused in the center and not around the edges. 

 

Related Content