Notification uses default sound instead of custom on Android 8 Oreo
Which platform(s) does your issue occur on?
- Android 8 Oreo
Please, provide the following version numbers that your issue occurs with:
- CLI: 3.4.3
- Cross-platform modules: 3.4.1
- Runtime(s): 3.4.2
- Plugin(s):
"nativescript-drop-down": "3.1.1",
"nativescript-geolocation": "4.2.0",
"nativescript-google-maps-sdk": "2.4.2",
"nativescript-ios-uuid": "1.0.0",
"nativescript-iqkeyboardmanager": "1.0.1",
"nativescript-local-notifications": "1.2.2",
"nativescript-phone": "1.3.0",
"nativescript-push-notifications": "1.1.2",
"nativescript-theme-core": "1.0.4",
Please, tell us how to recreate the issue in as much detail as possible.
Include a wav file in App_Resources folder:
nativescript-demo-app/app/App_Resources/Android/raw/notify.wav
Build the app and deploy to Android 8 Oreo device.
Send push notification to device with the following payload:
{
to : 'token',
data : {
message : 'message',
},
notification : {
title : 'title',
body : 'message',
icon : 'icon_notify', // defined in App_Resources
sound : 'notify', // defined in App_Resources
},
}
On older versions the custom sound is played, on Oreo default sound is used instead.
@ickata I think this is closely related to this PR is . You can test this case after the PR is merged into master.
OK, will do, despite the fact that the PR states that it fixes issue with the icon, not the sound...
@ickata the issue was related to the used version of the G9oogle Services library and the fix updates that dependency.
Hi, I updated the plugin to latest version (1.1.3). I'm still reproducing the issue.
In order to play custom sound in Oreo, one should create a push "Category" (also called channel). the OS made significant changes
@thematan : can you please give some details (example perhaps)?
https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels
https://developer.android.com/training/notify-user/channels
Well this is a nuisance, I've spent ages trying to figure this one out. Does anyone have any examples of how to create a notification channel on Oreo through NativeScript (JS)?
Anyone found solution for this? For me it even not working on older versions...
Hi @vforv, have you tried to implement your push notifications using the nativescript-plugin-firebase? It is more up-to-date with some features and could help you implement what you need. Also, we are in the process of moving features from push-plugin to nativescript-plugin-firebase, so this might be your best strategy long-term.