fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 998 forks source link

[Android] Notifications not received when app is killed #371

Open Alb93 opened 7 years ago

Alb93 commented 7 years ago

I do not receive any notification when the app is killed. Is this the expected behaviour?

The server code is { "notification":{ "title":"Notification title", "body":"Notification body", "sound":"default", "click_action":"FCM_PLUGIN_ACTIVITY", "icon":"fcm_push_icon" }, "data":{ "param1":"value1", "param2":"value2" }, "to":"/topics/all", "priority":"high", "restricted_package_name":"" }

The behaviour is correct if the app is in foreground or background.

mateusknob commented 7 years ago

Same issue here. The notification doesn't appears on notification bar.

Alb93 commented 7 years ago

On which phone model? Mine is Oneplus 3

mateusknob commented 7 years ago

Lenovo K5 with Android 6.0.1

ominfowavedesigner commented 6 years ago

yes i have same issue when app is killed not geting any notification. i have tested on android device please give me solution. server code is { "notification": { "title": "Notification title", "body": "Notification body", "sound": "default", "click_action": "FCM_PLUGIN_ACTIVITY", "icon": "fcm_push_icon" }, "data": { "param1": "value1", "param2": "value2" }, "to": "czmyvbwX0ow:APA91bHb-hQSBREUYHKVgAdt3yd2A0EWF6YySxRQB2iSgEDnAjFD-WFh2P8csJJDQNNYPwTkZvgmWGuCWv5z4I4y2c3ltIlI9XyCRXv1IZfoIwG6QLTJPels49siv_M_SqNoIFAGZ_aU", "priority": "high", "restricted_package_name": "com.garajatapp.garajat" }

Alb93 commented 6 years ago

In which phone model @ominfowavedesigner? I'm searching for solution but nothing for the moment.

Please if someone find It post here :)

mletrado commented 6 years ago

It's a bug of some devices https://stackoverflow.com/questions/33697368/gcm-push-notifications-not-working-if-the-app-is-closed-in-some-devices#answer-43091185

muralimariyappan commented 6 years ago

I receive notification in Android 6.0 but I get error in javascript FCMPlugin is not defied when running in mobile. But, it is working in android 5.0, i get notification and if i tap on it javascript works fine. any suggestions?

rahulhopin commented 6 years ago

I am.also facing this issue on OnePlus 3 and Xiami note phones. Does anyone know the workaround or any fix proposed yet?

RajuShetty commented 6 years ago

Check out this: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#huawei-and-xiaomi-phones

see if it can help you

sidharth016 commented 6 years ago

Using the plugin. When the app is in foreground or background. The notifications work fine with this "notification": { "title": "Notification title", "body": "Notification body", "sound": "default", "click_action": "FCM_PLUGIN_ACTIVITY", "icon": "fcm_push_icon" }

but when app is killed then the above body doesnt trigger a notification. On removing the click action attribute i started getting notifications

roshan608 commented 6 years ago

I had same problem with my Oneplus 3 device. This helped me with notification even if app is cleared from stack. https://stackoverflow.com/a/42651399/8837582

Also checkout the solution for ignore battery optimization. https://www.forbes.com/sites/bensin/2016/07/04/push-notifications-not-coming-through-to-your-huawei-phone-heres-how-to-fix-it/#62dc6d561ccc

abcdurga commented 6 years ago

Receiving push notifications when app is killed in android. Solved by this approach

ikismail commented 6 years ago

I had the same problem with Oppo device. Notification is not received when App is force closed.

Ionic Version - 4.0.6 Cordova version - 8.0.0 Android version - 8.1.0

borodatych commented 5 years ago

I had the same problem with Oppo device. Notification is not received when App is force closed.

Ionic Version - 4.0.6 Cordova version - 8.0.0 Android version - 8.1.0

You solved the problem? @ikismail

ikismail commented 5 years ago

@borodatych Actually, Notification is not received when the app is force closed. After that when I open the application I can able to receive that notification. I tried lot of methods to resolve this but failed.

abcdurga commented 5 years ago

Solved by this approach

Check this post. It is explained very clearly that why some devices are not receiving push notifications.

coolvasanth commented 5 years ago

I'm also facing this issue on multiple phones, does anybody has got solution for this ?? please let me know.

coolvasanth commented 5 years ago

I had same problem with my Oneplus 3 device. This helped me with notification even if app is cleared from stack. https://stackoverflow.com/a/42651399/8837582

Also checkout the solution for ignore battery optimization. https://www.forbes.com/sites/bensin/2016/07/04/push-notifications-not-coming-through-to-your-huawei-phone-heres-how-to-fix-it/#62dc6d561ccc

Where did you add the code that is mentioned on the stackoverflow link ? is it working on all the phones now ?