Available only for apps targeting Android 8.0 (API level 26) and above
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));
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 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.
So, what's next?
|Customizing push notifications|