Open jondspa opened 1 year ago
Figured it out.
Similar to the suggestion on this thread: https://github.com/katzer/cordova-plugin-local-notifications/issues/1589
I had to modify buildChannelWithOptions() to force importance=IMPORTANCE_HIGH in Manager.java.
public String buildChannelWithOptions(Uri soundUri, boolean shouldVibrate, boolean hasSound, CharSequence channelName, String channelId) { String defaultChannelId, newChannelId; CharSequence defaultChannelName; int importance;
if (hasSound && shouldVibrate) {
defaultChannelId = Options.SOUND_VIBRATE_CHANNEL_ID;
defaultChannelName = Options.SOUND_VIBRATE_CHANNEL_NAME;
importance = IMPORTANCE_HIGH;
shouldVibrate = true;
} else if (hasSound) {
defaultChannelId = Options.SOUND_CHANNEL_ID;
defaultChannelName = Options.SOUND_CHANNEL_NAME;
importance = IMPORTANCE_DEFAULT;
shouldVibrate = false;
} else if (shouldVibrate) {
defaultChannelId = Options.VIBRATE_CHANNEL_ID;
defaultChannelName = Options.VIBRATE_CHANNEL_NAME;
importance = IMPORTANCE_LOW;
shouldVibrate = true;
} else {
defaultChannelId = Options.SILENT_CHANNEL_ID;
defaultChannelName = Options.SILENT_CHANNEL_NAME;
importance = IMPORTANCE_LOW;
shouldVibrate = false;
}
newChannelId = channelId != null ? channelId : defaultChannelId;
// newly added, force importance to be high
importance = IMPORTANCE_HIGH;
createChannel(newChannelId, channelName != null ? channelName : defaultChannelName, importance, shouldVibrate,
soundUri);
return newChannelId;
}
WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Android - Notification is triggered. Device makes a sound. I can see the notification text in the notification center. But no the notification text does not show on the screen.
I've been using this great plugin for a while, trying to update to SDK API 31. Have also tried API 32.
Your Environment
cordova -v
): 10cordova platform ls
): 11.0.0Expected Behavior
Notification text should appear on the screen as it always has done.
Actual Behavior
No notification text appears.
Here's my triggering code, which has not changed.
Context
Debug logs
Many, many thanks! Jon