These docs are for v1.0. Click to read the latest docs for v2.0.

Notification Channel & Sound

Smartech offers a feature to add custom sound that will be played when push notification is delivered. Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each channel, you can set the visual and auditory behaviour that is applied to all notifications in that channel. Then, users can change these settings and decide which notification channels from your app should be intrusive or visible at all.

Create a notification channel

To create a notification channel, implement the following code:

SmtNotificationChannel.Builder smtBuilder = new SmtNotificationChannel.Builder(
                "<Channel_ID>",
                "<Channel_Name>",
                <Notification_Importance>);

//To set the description to the channel add below method. 
smtBuilder.setChannelDescription("<Channel_Description>");

//To set the group ID to the channel add below method. (Make sure that before setting group ID here, that group must be created before. Check the code below)
smtBuilder.setChannelGroupId("<Group_ID>");

//To set sound to channel, add below method. (Note that sound name must be without extention.)
smtBuilder.setNotificationSound("<Sound_File_Name_Without_Extenstion>");

SmtNotificationChannel smtNotificationChannel = smtBuilder.build();

NetcoreSDK.createNotificationChannel(context, smtNotificationChannel);

Note :
For Notification importance, you can pass below levels.

ImportanceUser-visible importance level
NotificationManager.IMPORTANCE_HIGH or
NotificationManager.IMPORTANCE_MAX
Urgent
Makes a sound and appears as a heads-up notification
NotificationManager.IMPORTANCE_DEFAULTHigh
Makes a sound
NotificationManager.IMPORTANCE_LOWMedium
No sound
NotificationManager.IMPORTANCE_MINLow
No sound and does not appear in the status bar

For more details, please refer Google's Channel Importance Level document .

Create a notification channel group

The following snippet demonstrates how to create a notification channel group.

NetcoreSDK.createNotificationChannelGroup(context, "<Group_ID>", "<Group_Name>");

Delete a notification channel

You can delete notification channels by calling the following method.

NetcoreSDK.deleteNotificationChannel(context, "<Channel_ID>");

Delete a notification channel group

You can delete notification channels group by calling the following method.

NetcoreSDK.deleteNotificationChannelGroup(context, "<Group_ID>");