Android Notifications

How to create push notification for Android

Visible notifications

Visible notifications is the most common type of notifications. Users receive a message, which is displayed in the notification center of their devices.

Languages

It is possible to sent notifications in several languages to make them more accessible to users from different countries. When the language used on a device is specified among languages of the campaign, the notification is sent in this language. In case there is no device language among languages of the campaign, the message is sent in the language that is specified as a default language.

To add or remove a language press the button with a ‘+’ sign.

First, you need to choose the language that will be used by default. In most cases it is English.

Each language is presented in a form of a tab. When switching between tabs, please fill the required fields with translations. Translations are necessary for such fields as ‘Title’, ‘Text’ and ‘Share text’ (if it is used). The rest of notification settings are general and do not depend on translations.

Title

A short line that describes the purpose of notification.

Notification titles should:

  • Be under 30 characters long

  • Contain the most important information

  • Exclude the app's name, which already appears in the header

Text

The main message that is presented in a push notification.

The text of notification should:

  • Not exceed 40 characters

  • Avoid repeating the title

As long as the title and text are sent in a Unicode format, you can use texts and emoji supported by this format to diversify the way your notifications look. The list of available emoji is here. We recommend you to test how messages with emoji are displayed on a device before sending them to wide audiences.

App icon / small icon

The app icon is a small two-dimensional representation of your app's identity. It appears in monochrome in the status bar. If your app sends a wide range of notifications, you may replace your app's identity icon with a symbol that reflects the type of content. For example, Google now uses a cloud icon for notifications about weather.

The source of image can only be the resource of application (its name).

Small icon background

Depending on the version of Android, this function either fills the background, on which the small icon is displayed, with the specified color (Android M), or colors the small icon, app’s name and texts of actions displayed in notifications (Android N).

Large icon

In Android N, the large icon is meant only for specific situations, in which the image meaningfully reinforces the notification's content, including:

  • Communication from another person, such as the image of someone sending a message

  • The source of content if it's different from the app that sends the notification, such as the logo from a YouTube channel to which the user is subscribed

  • Meaningful symbols about the notification, such as an arrow symbol for driving directions

  • Large icons should have a round shape when showing a person and square in all other cases

The source of image can be the resource of app (its name) and the URL to the file on the web.

Android allows to use images of large size as large icons. However, in case the image will have to be uploaded by the device from the internet, it is better to use images with resolution that provides a good quality of image, but is as small in size as possible.

We recommend to use square images that don’t exceed 192x192 resolution.

Images with different aspect ratio are scaled proportionally along the long side to the display area size.

Big picture

Use this template when your notification contains a picture. The large icon offers a thumbnail of the picture, and the user can get a bigger preview by expanding the notification.

The source of image can only be the URL to the file on the web.

Android allows to use images of large size as a big picture. However the device will have to upload the file from the internet, therefore it is better to use images with resolution that provides a good quality of image, but is as small in size as possible.

We recommend to use images with 2:1 ratio that don’t exceed 768х384 resolution.

If you want the image to be fully displayed in the message, the proportion of the aspect ratio of the image should be 2:1 (width:length). Otherwise, the image will be scaled to the size of the notification display area and centercropped to the ratio 2:1.

Sound

Тhe name of a sound file in the application bundle (resource name). The sound in this file is played as an alert. If the sound file doesn’t exist or “default” is specified as a value, the default alert sound is played. The audio must be in one of the audio data formats that are compatible with the system sounds. If the option is switched off, the notification comes silently.

LED color

You can specify the color of LED that will notify users about an unread message. The device will display the color as close as possible to the one you specified. Unfortunately, not all Android devices have LED. Also, users can block the use of LED.

Collapse key

Notifications are not collapsible by default.

If multiple messages are sent with this key, the most recent message will suppress all previous unread messages with the same key.

Collapsible messages are a better choice from a performance standpoint provided your application doesn't need to use non-collapsible messages. However, if you use collapsible messages, remember that GCM only allows a maximum of 4 different collapse keys to be used by the GCM connection server per registration token at any given time. You must not exceed this number, or it can cause unpredictable consequences.

Parameters

You can pass custom parameters with messages and use them within the app. For instance, you can activate advertising campaign or any other functionality for a user who has received this message.

With this function you will be able to send any data, the processing of which can be pre-programmed, in a key-value format to the app. For example, it is possible to activate a promotion or perform any other activity within the app.

Interaction

Action

The action after a click on the body of a notification. By default, the click opens an app.

It is possible to perform the following actions:

  • Home screen - this is the default behavior when a user taps on a push notification. It opens app’s home screen

  • Deep link - directs a user to a specific resource either within your app or on the web

  • Web page - opens a web page in a mobile browser or any valid device-level URL, such as Google Play or app protocol links

  • Share - the ‘Share’ action drives users to share your message when they interact with the push notification. In case of selecting this action, don’t forget to specify translations of share texts into all languages used in your push campaign

Buttons

Before choosing the template of notification buttons, it is necessary to select the language of the message, which will be used by default (usually it is English).

Accessible button templates can be found in the table with button templates or directly in the interface.

After you have selected the template, you need to set the action of the button. We do not recommend to use actions that contradict the text on the button. Also, the action of the button should not duplicate the action that is used after tapping on the notification body.

In case you are not satisfied with the template you have chosen, you can replace (‘Set another template’ button) or delete it.

The set of accessible actions:

  • Home screen - this is the default behavior when a user taps on a push notification. It opens app’s home screen

  • Deep link - directs the user to a specific resource either within your app or on the web

  • Web page - opens a web page in a mobile browser, or any valid device-level URL, such as Google Play or app protocol links

  • Share - the ‘Share’ action drives users to share your message when they interact with the push notification. In case of selecting this action, don’t forget to specify translations of share texts into all languages used in your push campaign.

  • Dismiss message - dismiss the message, without taking the user into the app

Invisible notifications

Invisible notifications can be used in case you need to send some command to an app and make it invisible to users. Users will not see the message and will not be notified by a special notification signal. This kind of notification is aimed at the app, not users.

Parameters used for sending the data to the app are the same as described in the section about visible notifications.

Invisible notifications can use ‘Collapse key’ and ‘Delay while idle’ settings.

Last updated