Notification sound and icon on Android
See original GitHub issueHi, there!
I’m having issues with the sound of the notifications, at first I think it vibrated (may be wrong about this), now it does nothing. Here’s my code:
var date = '2016-08-11';
var time = '04:16';
var title = 'Test';
var message = 'This is a test';
var schedule_time = new Date((date + " " + time).replace(/-/g, "/")).getTime();
schedule_time = new Date(schedule_time);
window.plugin.notification.local.schedule({
id: "1",
date: schedule_time,
message: message,
title: title,
sound: 'SYSTEM_DEFAULT',
icon: 'www/icon.png' //It's a 300x300 icon
autoCancel: true
});
I’ve tried putting ‘android.resource://’ + package_name + ‘/raw/beep’ (beep is stored in www/ and in platforms/android/res/raw), ‘android.resource://’ + package_name + ‘/raw/beep.mp3’ (just added the .mp3), ‘TYPE_ALARM’, ‘SYSTEM_DEFAULT’, ‘www/beep.mp3’, ‘file:///www/beep.mp3’, an URL… To no avail, no sound at all. I’ve tried with the icon too, but less stuff, just the URL and the file path there’s in the code I wrote here, just appears a square with rounded corners instead of the bell.
The version I’m using is the 0.8.4, and the Android version is 6.0.1.
Thanks in advance for your help!
Issue Analytics
- State:
- Created 7 years ago
- Comments:13
create a folder in cordova “platforms/android/res/drawable” copy your icon into it (name must be lower case – make it “sm_icon.png”) refer to is as “res://sm_icon.png” in notification
For the icon you should prefix it with
file
so it looks like so:file://icon.png
. You can omit thewww
part because thefile://
protocol automatically adds this. This is documented here on the wiki