push-plugin icon indicating copy to clipboard operation
push-plugin copied to clipboard

Notification uses default sound instead of custom on Android 8 Oreo

Open ickata opened this issue 7 years ago • 10 comments

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 avatar Mar 23 '18 19:03 ickata

@ickata I think this is closely related to this PR is . You can test this case after the PR is merged into master.

NickIliev avatar Mar 30 '18 07:03 NickIliev

OK, will do, despite the fact that the PR states that it fixes issue with the icon, not the sound...

ickata avatar Mar 30 '18 08:03 ickata

@ickata the issue was related to the used version of the G9oogle Services library and the fix updates that dependency.

NickIliev avatar Mar 30 '18 14:03 NickIliev

Hi, I updated the plugin to latest version (1.1.3). I'm still reproducing the issue.

ickata avatar Apr 09 '18 19:04 ickata

In order to play custom sound in Oreo, one should create a push "Category" (also called channel). the OS made significant changes

thematan avatar Apr 26 '18 09:04 thematan

@thematan : can you please give some details (example perhaps)?

ickata avatar Apr 26 '18 09:04 ickata

https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels

https://developer.android.com/training/notify-user/channels

thematan avatar Apr 26 '18 10:04 thematan

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)?

AndrewBNZ avatar Jun 06 '18 10:06 AndrewBNZ

Anyone found solution for this? For me it even not working on older versions...

vforv avatar Aug 17 '18 14:08 vforv

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.

tbozhikov avatar Aug 24 '18 12:08 tbozhikov