Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

Android "heads-up notifications" not showing up even with "android_priority" set to 2 #382

Open weichen35 opened 1 year ago

weichen35 commented 1 year ago

The "heads-up notifications" (aka the "Pop on Screen" feature shown below in the image) on Android will not show up after the device receives a push with android_priority set to < 1 (i.e. priority lower than "high").

I was able to see the "heads-up" when I sent a push with android_priority: 2, to an app freshly installed on my device. However, after receiving a push with android_priority: 0, the "heads-up" no longer showed up, even if subsequent pushes with android_priority: 2 were sent. It appears that receiving a medium to low priority push on a device will make the "Pop on Screen" option stuck at false forever, until the app is re-installed.

My dependencies: pushwoosh-cordova-plugin 8.3.2 cordova-android 8.1.0

Devices that showed this behavior: Actual Pixel 5 API level 33 Emulator Pixel 5 API level 31

wfhm commented 1 year ago

@ethanchen35 This is actually weird. On Android 8+, all notification settings, such as sound, vibration, showing pop-up notifications, are applied to a notification channel, not to a notification itself. Settings are applied to a channel once and can only be changed manually by a user, so there should be no way for you to disable showing a pop-up notification remotely or programmatically from the application itself.

I was able to reproduce the issue with an Android 13 device, and we will investigate this. Meanwhile, as a workaround, you can send pushes with high priority to a separate notification channel. You can find the guide by the link below:

https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/android-push-notifications/customizing-android-sdk/notification-channels

weichen35 commented 1 year ago

Thank you for the response. Yes, increasing priority on a new channel works. It appears that making a non-channel push to show pop-up still works, but it just has the mentioned weird behavior. Hope you have a smooth debug process.