Local notification sound not working on android

I want a custom sound for a scheduled notification with the sound parameter. I expect it to play the sound when local notification goes off, but I just get the default notification sound on device.

Here’s everything that I’ve tried so far: (These are the ‘solutions’ I found across the internet)

  • Custom sound works with no problem on iOS
  • Tried using another device and doesn’t work on there too.
  • Tried using different versions of local-notifications, android platform, etc
    “ionic-native/local-notifications”: “^4.7.0”, - current one I’m using,
    android 6.4.0 - current one I’m using
  • Verified that sound file is indeed in www folder, also tried putting it in a sounds folder within assets, like I found on a tutorial
  • Used @ionic-native/native-audio to play the sound file so I can verify that the sound file works and can be reached by the app.
  • Used cordova-plugin-filepath to first get the file path of the file before using it to schedule a local notification
  • I tried scheduling my local notification with a slight delay with the trigger parameter
  • I tried different file paths both in www and assets/sounds/ using file://,file:///, media://, content://, etc
    • ‘file:///android_assets/ding2.ogg’
    • ‘file:///android_assets/www/ding2.ogg’
    • ‘file://android_assets/www/ding2.ogg’
    • ‘file:///android_assets/www/assets/sounds/ding2.mp3’
    • ‘file:///ding2.mp3’
    • ‘file://ding2.mp3’

Here’s a bit of code:
this.localNotifications.schedule({
id: 1,
title: ‘Balance Changed:’,
text: notificationText1,
sound: ‘file://ding2.mp3’
});

Here is my ionic info:
cli packages: (C:\Users\isaganiesteron\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
local packages:
@ionic/app-scripts : 1.3.7
Cordova Platforms : android 6.4.0
Ionic Framework : ionic-angular 3.4.2

System:
Android SDK Tools : 26.1.1
Node : v8.11.1
npm : 5.8.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\isaganiesteron\AppData\Local\Android\Sdk
Misc:
backend : pro

Let me know of any additional information I need to put.
Thank you very much.

3 Likes

I got the same problem in Ionic 4 same plugin.

Inform me if you find a soultuion for it.

This is i BUG because i have tryied everything.

Please got to https://github.com/katzer/cordova-plugin-local-notifications/issues

and report it there so it can be handled to be fixed.