Customizing a Push Notification

You can customize the details of a push notification with FCM control fields.

You can use the control fields described in this topic with Push to User and Direct Push notifications. A Push to App notification is not customizable and the default settings of Kii Cloud are applied.

Customizing an FCM push notification

There are some fields for customizing the FCM push notifications. Here we explain some of such fields. For the full coverage, see the Google official documentation.

In addition to the control fields below, you can include custom data in a push message and use it in your mobile app. When you design the custom data, keep in mind that the maximum payload size through FCM is 4096 bytes.

Collapse key

The collapse_key key is used to collapse multiple messages into one when the device is idle. The messages with the same key will be grouped. If the key is not specified, all messages will be delivered to the device.

Restricted package name

By setting the restricted_package_name key, only the mobile app that has the specified package name will receive the push message.

Time to live

The time_to_live key specifies the time (sec) the FCM server keeps the message when the device is not connected to FCM. If not specified, the FCM server will keep the message for 4 weeks by default.

If you are using the time_to_live, you must also specify the collapse_key; you will get an error otherwise.

Delay while idle

The delay_while_idle key specifies if you want to send the push message when the device is idle. By setting the key to true, the push message will not be delivered to the device until the device becomes active.

If the message is not delivered instantly, duplicating messages will be deleted using the collapse_key.