Open CreativeArtDesign opened 5 years ago
Follow this example, I put the print of the structure and where is the file bell.mp3 ` cordova.plugins.notification.local.schedule({ title: 'The Big Meeting', text: '4:15 - 5:15 PM\nBig Conference Room', smallIcon: 'res://mipmap-mdpi/icon.png', icon: 'file://img/apple-icon.png', sound:'file://sounds/bell.mp3' });' https://imgur.com/a/Fsv4P29
Hi, Thank you for your answers. I followed your 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.
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
Hi, If you really want to help me to find the bug as i assure it is, you can download my working sample in zip. This project is only your 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.
Best regards
Or if you have a working example please send me the sample file so i can test my self. and see what the differences is between my code and your code. Please
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!!
Can you please fix this bug???
PLEASE PLEASE PLEASE!! Or tell me where in the code i should look so i can fix it in my application and give you feedback about it.???
I'm using this code that working fine with beta3:
setSound() {
if (this.platform.is('android')) {
return 'file://assets/sounds/1110.mp3';
} else {
return 'file://assets/sounds/1110.caf';
}
}
scheduleNotification() {
this.localNotifications.schedule({
id: 1,
title: 'Attention',
text: 'Notification after 5 seconds',
vibrate: true,
sound: this.setSound(),
smallIcon: 'res://calendar', // Solo Android ??
led: { color: '#FF00FF', on: 500, off: 500 }, // Solo Android ??
data: { mydata: 'My hidden message this is' },
trigger: { in: 5, unit: ELocalNotificationTriggerUnit.SECOND },
foreground: false // True = Show the notification while app is open
});
}
have you found other solution ?
So is anyone going to fix this or not??
i think this plugin prj is dead :(
not good... any other solution how to use custom notification sounds?
peek at pull request 1696 that adds channels to Android. Note the comment at the bottom of this particular post https://github.com/katzer/cordova-plugin-local-notifications/pull/1696#issuecomment-434475267 as there appears to be some magic android hand waving that has to be done when you alter the configuration. My guess is: completely delete your app and reinstall.
CAVEAT: I don't use custom sounds so am neither informed or qualified to comment!
hi, have you find a solution? I'm facing same
What is the path for the root sound path? There are no documentation where to put the file? Please tell us where we should put our mp3 files.
Provide a general summary of the issue.
Your Environment
cordova -v
):cordova platform ls
):Expected Behavior
Find the path?
Actual Behavior
Dont find the path
Steps to Reproduce
Reproduce this issue; include code to reproduce, if relevant
file://???
Context
What were you trying to do?
Debug logs
Include iOS / Android logs