Android
To use custom push sounds you must add the sound files you wish to play to your project as a resource. Sound files need to be located in the "res/raw" directory of the app.
Beginning in android Oreo, for a notification to use a custom sound it needs to be configured in a notification channel.
To create a notification channel for a sound you would call 'PushConnector.createNotificationChannel'. The function takes three parameters, a context, a string for the channel name, and the name of the sound file minus the extension. So for example, if I have a sound file called swish.mp3 in my res/raw folder, I would create a channel like as follows:
PushConnector.createNotificationChannel(this, "swishChannel", "swish");
You can then use these sounds when creating a push notification campaign on the platform All that needs to be passed in on the platform side is the name of the file. So if I wanted to play file with the path of "res/raw/gong.m
iOS
To use custom push sounds you must add the sound files you wish to play to your project as a non-localized resource of the application bundle as shown below. For more on bundle structure see Apple's Bundle Programming Guide
You can then use these sounds in your app home when creating a campaign. You simply enter the file name under sound on the iOS Channel screen as shown below. The audio data can be packaged in an aiff, wav, or caf file and for more on preparing custom alert sounds see Apple's Local and Push Notification Programming Guide.
Note:
The sound field on the platform has moved to the push categories section so when setting up notifications with sounds this is now done when configuring a push category. This is where buttons for interactive notifications and other special features of push variants are also setup:
https://support.xtremepush.com/hc/en-us/articles/115004738765-Set-up-Interactive-Notifications-on-the-Platform-
Comments
0 comments
Article is closed for comments.