Question:
How to properly send a push notification with your own custom sound to Android 8+ devices?
Answer:
First of all, please make sure that you have placed your audio file to the necessary folder. For the native Android framework, your files should be placed to /app/src/main/res/raw folder, for example. The information about the necessary folder for other frameworks(Unity, Cordova etc) you can find in the respective guide for each of them.
Starting from Android 8, in order to send the notification with your own custom sound, you need to create its own Notification Channel for each of them.
Here are the steps below to send the push notification with custom sound to Andoird 8 devices:
Using the Pushwoosh Control Panel, all you need to do is to specify the following parameter within the "Android root params filed" from the "Send push" form:
{"pw_channel": "PUSH NOTIFICATION CHANNEL NAME"} // here you need to specify the name for your channel with custom sound
Additionally, specify your audio file name in the "Sound" field.
In case of using remote API, please note that it necessary to specify the parameters below within your /createMessage API request:
"android_root_params": {"pw_channel": "push"}
// here you need to specify the name for your channel with custom sound, for example, "push" for the notifications with push.wav
sound. "android_sound": "push"
// here you should specify the file name without extension
Once you have sent the push with the parameters above, the respective channel with the specified channel will be created on each device with Android 8. This procedure should be performed for each the custom sound.
Now, to send the push with the custom sound, you need to specify the respective channel as well as your own custom sound.
Labels - Android, sound, custom notification sound, Android 8, Notification Channel,
Comments
0 comments
Please sign in to leave a comment.