WebEngage SDKs 2.7.0 and above support Android push notification channels.
Notification channels provide a unified system to help you manage notification behaviour depending on their type. For push notifications sent via WebEngage, you can define the behaviour of the properties mentioned below using notification channels. To do this, add the respective
meta-data tags in the application element of your
AndroidManifest.xml as shown below. All push notifications sent via WebEngage are bundled in a single channel.
You can modify default push channel configurations by calling specific methods of
PushChannelConfiguration class and providing its instance to
WebEngageConfig during SDK initialization as shown below.
PushChannelConfiguration pushChannelConfiguration = new PushChannelConfiguration.Builder() .setNotificationChannelName("Offers") .setNotificationChannelDescription("Product offer weekly updates") .setNotificationChannelImportance(3) .build(); WebEngageConfig webEngageConfig = new WebEngageConfig.Builder() .setDefaultPushChannelConfiguration(pushChannelConfiguration) .build(); registerActivityLifecycleCallbacks(new WebEngageActivityLifeCycleCallbacks(this, webEngageConfig));
This is the channel name which is visible to the user.
This is the channel description which is visible to the user.
pushChannelConfiguration.setNotificationChannelDescription("Product offer weekly updates")
Sets one of five importance levels that configure the amount a channel can interrupt a user, ranging from
IMPORTANCE_NONE (0) to
IMPORTANCE_HIGH (4). The default importance level is 3 which displays everywhere, makes noise, but doesn't visually intrude on the user.
Sets the notification light color for notifications posted to this channel if the device supports this feature.
enableLights is automatically called by WebEngage SDK when you set this tag.
Sets whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. See e.g.
Sets whether notifications posted to this channel can appear as application icon badges in a Launcher.
Sets the sound that should be played for notifications posted to this channel and its audio attributes. Notification channels with an importance of at least
IMPORTANCE_DEFAULT (3) should have a sound. Set
android:value as the name of the file without the extension. This file must be in the
resources/raw folder of your app.
Sets whether notification posted to this channel should vibrate.
Sets the group this channel belongs to. Group information is only used for presentation on the user's device, not for behavior.
value is the group ID of the group that you want to use.
pushChannelConfiguration.setNotificationChannelGroup("GROUP_ID") //Provide a valid group ID
By default, these properties are assigned the following values.
Please feel free to drop in a few lines at [email protected] in case you have any further queries. We're always just an email away!
Updated 11 months ago
So, what's next?
|Customizing push notifications|