Overview
info |
Notification Channel Setup Heads-up notifications are supported only through Android notification channels. Please refer to the official documentation for the creation of the notification channels. On Android devices using API levels under 26, the configuration won't be applied, as notification channels that need this setting weren't available until API level 26.
|
Configuration
In MoEngage Android version 13.06.00, a new flag isDirectPostingForHeadsUpEnabled has been added in the NotificationConfig. If you are using HeadsUp Notification, we strongly recommend you pass the isDirectPostingForHeadsUpEnabled flag as true while initializing SDK. By default, it will be false.
For more information about API reference for all the possible options, refer to NotificationConfig.
Use the configureNotificationMetaData() to transfer the configuration to the SDK.
val moEngage = MoEngage.Builder(this, "XXXXXXXX")
.configureNotificationMetaData(NotificationConfig(smallIcon = R.drawable.small_icon, largeIcon = R.drawable.large_icon, isDirectPostingForHeadsUpEnabled = true))
.build()
MoEngage.initialiseDefaultInstance(moEngage)
MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXX")
.configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon,R.drawable.large_icon,R.color.notiColor,isMultipleNotificationEnabled,true))
.build();
MoEngage.initialiseDefaultInstance(moEngage);
HeadsUp Notification Behaviour
If isDirectPostingForHeadsUpEnabled is true, SDK will use a direct posting mechanism to post Rich content directly if it's a high-priority channel. So the floating heads-up notification view will be shown for 5-8 seconds if it is not interacted with. On Android versions prior to API level 26, the flag will be ignored by default, and it will use the re-posting mechanism by default.
Otherwise, if isDirectPostingForHeadsUpEnabled is false, it will use the existing reposting mechanism, where text is posted first, and once media assets are downloaded, rich content is posted. This is to ensure at least some content is shown to the user immediately when the notification is received and to maintain a good impression rate. If this is the case, a heads-up window will get dismissed within few seconds due to reposting.
Non-Headsup Notification Behaviour
For notifications with channel ID having channel importance other than IMPORTANCE_HIGH, SDK will be using the reposting mechanism by default.
Please refer to the user guide to understand more about the heads-up notification behavior and OEM limitations.