Provide a general summary of the issue.
cordova -v): 8.0.0cordova platform ls): Android 7.0Show Notification on head-up on adnroid device
it;s not show popup on header of device, it just show small icon for notification on top left of device
this is my code
this.localNotifications.schedule({
id:1,
text: 'Delayed ILocalNotification',
trigger: {at: new Date(new Date().getTime() + 3600)},
led: 'FF0000',
priority:1,
sound: 'file://assets/sound/sound1.mp3' });
I already tried to different on device, it result not different
Just tested it on beta 3. In order for heads-up to work, it would appear that these needed to be true:
foreground: truepriority: 1 (or 2)sound: either true, or a path that correctly resolves to a playable file. In your case, I am not sure if sound1.mp3 exists.foreground property is not supported on this version : ^0.9.0-beta.2
@himalayaahuja
It's not clear what you are trying to do. You are also using an old version of the code.
Create a new issue rather than simply adding things onto this one.
Just tested it on beta 3. In order for heads-up to work, it would appear that these needed to be true:
foreground: truepriority: 1(or 2)sound:eithertrue, or a path that correctly resolves to a playable file. In your case, I am not sure ifsound1.mp3exists.
tested all variations of code and parameters, read through all posts here.
no, head-up display of notifications definitely does not work with local.notifications beta.3 (Android 8.1.0)
I'm using the latest Beta, I've tried Beta 2 and 3 and it appears not to work, my notifications:
cordova.plugins.notification.local.schedule({
title: 'Test Notification',
text: 'test',
lockscreen: true,
priority: 1,
sound: true,
foreground: true
});
"cordova-plugin-local-notification": "0.9.0-beta.3"
"phonegap-plugin-push": "^2.2.3"
this.localNotifications.schedule({
silent: false,
id: 1,
title: "Cashberry",
text: notification.message,
led: "FF0000",
sound: "default",
priority: 2,
foreground: true
});
this issue is still persistent. It should have been resolved by now. Please help out if anyone of you has found the solution.
on Android 8+, the priority is determine by channel importance
https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
Last item on Android 8 changes
https://developer.android.com/guide/topics/ui/notifiers/notifications#android_80_api_level_26
From what I can see, the issue is
In Manager.java file
`
private void createDefaultChannel() {
NotificationManager mgr = getNotMgr();
if (SDK_INT < O)
return;
NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID);
if (channel != null)
return;
channel = new NotificationChannel(
CHANNEL_ID, CHANNEL_NAME, IMPORTANCE_DEFAULT);
mgr.createNotificationChannel(channel);
}
`
@8bhsolutions I think you're right. To test this out, I changed the "IMPORTANCE_DEFAULT" to "IMPORTANCE_HIGH", at which time the notifications were displayed as headsup. This is on Android 9 and 10. The priority, sound, vibrate and foreground all had no effect.
@8bhsolutions did you try this PR #1696
Nope.
I found the cause of the issue, as noted in my earlier comment.
I don't know the plugin well enough to implement a generic fix.
Most helpful comment
tested all variations of code and parameters, read through all posts here.
no, head-up display of notifications definitely does not work with local.notifications beta.3 (Android 8.1.0)