Android channels are used to group notifications based on its content, purpose etc., allowing to show different groups of notifications in different ways. For example, you can have "Urgent updates" and "Promo notifications" groups in your app, and a user can control if he wants to receive pushes for these topics separately, e.g. showing a notification banner, playing sound and vibrating when an Urgent update push is received, and disabling notifications for promotional pushes at all.
The integration of channels is really simple code-wise, however there are several moments to remember.
1. Pushwoosh SDK supports Android channels starting with 5.4.0 version. To add a channel to a notification you should add "android_root_params":{"pw_channel":"channel_name"} to your /createMessage request (or add root params using a dedicated input field in Send Push form in the Control Panel). If no channel was specified, a default "Push Notification" channel will be used.
2. Channel settings include options to control showing a notification banner (so called Heads-up notifications), showing a notification in Notification Center, playing sound (and customizing it), vibration and LED. A developer has access to channel settings only when creating a channel. You cannot modify channel settings after a channel is created - only end users have access to it.
This means that some of push notification settings specified in Send Push form or in your /createMessage request will be applied to the channel, not to a particular notification. For example, if you send a push with a custom sound and "importance":1, and specify {"pw_channel":"Important pushes"} , custom sound and importance level will be specified as channel setttings for all devices that receive this push and do not have such a channel registered. Even if you change sound or disable it and/or change importance level, if you send a push to "Important pushes" channel, all devices that have this channel registered, will receive it with a predefined custom sound and with Importance level 1.
Keep in mind that Pushwoosh SDK generates a default "Push Notifications" channel - even if you do not specify a channel in Send Push form or in /createMessage request intentionally, a channel is still generated. This means that all the push settings you specify in a push that is first received on a device for "Push Notifications" channel will set up notification appearance and behavior for this channel.
3. Pushwoosh backend does not store notification channel settings at all. This might lead to the following situation - you have 1 device registered, you send your first push to a default channel and specify a custom sound. A device receives this push, registers a channel with a custom sound preference. Then you register another device and send a push to the same channel, but without a sound at all. The second device will receive a push and register a channel with disabled sound. The first device will still play sound regardless of sound preferences specified in your push, and the second device will never play sound, regardless of push sound preferences.
Comments
0 comments
Please sign in to leave a comment.