Steffaan / cordova-plugin-local-notifications

Cordova Local Notifications Plugin
Apache License 2.0
31 stars 38 forks source link

Custom Sound does not work in notification !! BUG! #13

Closed CreativeArtDesign closed 5 years ago

CreativeArtDesign commented 5 years ago

This is really a BUG, I followed the example still issue it play the original notification sound when I get a notification not the one i specified. But it does not work even the path is right.

  1. Compiled and signed the packed and tested it on my phone. Nokia 7 plus
  2. Path does not work see my path below.
  3. Does it not allows assets folder? Even if it is in right place?

Ionic: ionic (Ionic CLI) : 4.10.3 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.0.1 @angular-devkit/build-angular : 0.12.4 @angular-devkit/schematics : 7.2.4 @angular/cli : 7.2.4 @ionic/angular-toolkit : 1.2.3

Cordova: cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.4 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.3, (and 12 other plugins) System: NodeJS : v10.15.0 (/usr/local/bin/node) npm : 6.8.0 OS : macOS Mojave Xcode : Xcode 10.1 Build version 10B61

If you look in my www folder it is the same structure. as src so what is wrong here?

As i mentioned this is my code and paths is following:

        var arrayOfNotifications = [{
            id: id,
            sound: 'file://assets/audio/sms.mp3',
            trigger: { at: myDate }, // MUST be a date object
            text: type,
            title: information,
            data: { mydata: 'My hidden message this is' },
            actions: [
                { id: 'yes', title: 'Yes' },
                { id: 'no',  title: 'No' }
            ],
            foreground: true
          }];
          this.localNotifications.schedule(arrayOfNotifications);
        }

In my project i have following path. My app ---platform ---plugins ---resources ---scr ------app ------assets ---------audio ----------> sms.mp3 ---------css ---------fonts ---------icon ---------img ---------xml ------environments ------theme ---www ------assets ---------audio ----------> sms.mp3 ---------css ---------fonts ---------icon ---------img ---------xml ------cordova-js-src ------plugins ------svg

You can download my working sample in zip.

This project is only the plugin with a button that trigger the notification in 3 seconds it should play a file but no. Be sure to play the sms.mp3 so you know its right file that is playing. I only getting standard phone notification sound to play.

www.aishacenter.se/noti.zip

This is my Ionic 4 with local notification and audio files.

This is really a BUG, i have tested this code with wav or mp3 and the path is right what i have used before.

this is the same path and i have test the path with picture and wav and mp3 files only the picture is working the sound does not. It is the same path so the path is right. The code that handle the sound file is wrong.

  icon: 'file://assets/icon/favicon.png',
  sound: 'file://assets/icon/sms2.wav'

I have put both files in same folder to test the path favicon.png working the sound does not.

So this is 100% a bug in beta 0.9.0 beta 3.

I have tested everything now and are stuck with this BUG!!

CreativeArtDesign commented 5 years ago

Can you please fix this bug?

Steffaan commented 5 years ago

Have some patient please, your spamming the original repo with 3 issues that are exactly the same and place a issue here while using version beta 0.9.0 beta 3, which is not the version provied by this fork.

Try starting out with using this fork and provide a channel name to even start supporting recent android versions. Let me know when you did and how that works out for you.

Steffaan commented 5 years ago

If you actually use this fork, you won't even had this bug at all, since it's fixed here. Problem in master repo is that the sound must be set in the channel and not in the builder anymore.

Closing this issue because it's invalid.