Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Notification does not shown on background/killed states #254

Open
omerguvenis opened this issue Nov 10, 2023 · 2 comments
Open

Android Notification does not shown on background/killed states #254

omerguvenis opened this issue Nov 10, 2023 · 2 comments

Comments

@omerguvenis
Copy link

Bug Report

Android Notifications does not shown on background and killed states on latest 4.0.0 version.
The phone receives the notification (I see it via doing *#*#426#*#*).

Expected Behaviour

It should be shown when sending via data tag.

Actual Behaviour

It is not shown when the app is background, but it is shown when I send FCM push with notification tag.
Also, I noticed that, when I send the push message and it is not delivered, then when I open the app again, the app starts from the begining (splash screen). I mean, when the app receives any push message when it is on background, it behaves as it is killed and starting again.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

I tried it on Android 7, 8, 10, 11. All same behaviour.

(Android) Device Vendor (e.g. Samsung, HTC, Sony...)

Samsung and RedMi.

Sample Push Data Payload

{
   "message":{
"token":"xxxxxxxxxx",
      "android":{
         "priority":"HIGH",
         "data":{
            "title":"TITLE (title): ı.I.i.İ.ğ.Ğ.ü.Ü.ş.Ş.ç.Ç-X",
            "message":"BODY (message): ı.I.i.İ.ğ.Ğ.ü.Ü.ş.Ş.ç.Ç-X",
            "sound":"notification",
            "icon":"icon",
            "android_channel_id":"nc-default",
            "channelId":"nc-default",
            "badge":"1",
            "notification_count":"1",
            "a":"27",
            "v":"4521960",
            "notId":"39459313",
            "vibrate":"false"
         }
      }
   }
}
@fishsaidno
Copy link

Confirmed same behaviour.
This is somewhat documented here: https://github.com/havesource/cordova-plugin-push/blob/master/docs/PAYLOAD.md#notification-vs-data-payloads

In previous versions of Android/Cordova, sending the title/body etc. only in the data key as documented, the notification would be displayed when the app was in the background.

Currently, when sending with the notification key, the plugin behaves as documented, the Android system will display the notification, but the plugin's handlers don't run.

Also, I noticed that, when I send the push message and it is not delivered, then when I open the app again, the app starts from the begining (splash screen). I mean, when the app receives any push message when it is on background, it behaves as it is killed and starting again.

Noticed this also, sending the notification with details in the data key only - when received while the app is in the background - the app crashes.

@xandl
Copy link

xandl commented Jun 3, 2024

any news on this one?

when running logcat i see the notification but then, nothng is shown in notification center.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants