firebase / quickstart-android

Firebase Quickstart Samples for Android
https://firebase.google.com
Apache License 2.0
8.86k stars 7.32k forks source link

No pop up notification and sound when app killed / in background #128

Closed HartzDev closed 8 years ago

HartzDev commented 8 years ago

Hai,

i use firebase cloud messaging.
i have the toturial, and it works. notification pop up shown and sound , if app in foreground. but when app killed or in background, i get the notif, but no pop up and sound. do i need add some code ??

thx.

aldocd4 commented 8 years ago

I have the same problem on my Honor 7

Android 5.0.2.

UPDATE :

Ok guys sorry, I have found the problem. On Huawei phones, there is a "feature" called Protected Apps, you need to enable FCM quickstart demo in this list.

You can follow this link for more informations : http://stackoverflow.com/questions/31638986/protected-apps-setting-on-huawei-phones-and-how-to-handle-it

kroikie commented 8 years ago

@HartzDev what device are you using? Could it be something similar to what @misu-rg reported?

HartzDev commented 8 years ago

@kroikie sorry, for late response, i use samsung J5. i have look for option protected Apps in my device, but no result :(.

kroikie commented 8 years ago

Hi @HartzDev couple of clarifications:

Please add the following:

Also: Do you see this same issue if you are using an emulator with Google services?

HartzDev commented 8 years ago

Hi,

i have do more digging, and find that for process in background, we set all from json. so when i put parameter sound, my notif give sound.

thx for all help guys :D

sirsendu-maity commented 7 years ago

Hi HartzDev

I am facing same problem please help

thanks

johnearlelevado commented 7 years ago

This is very important. Most cases of this problem has got to do with the settings on your Android Phone. Like for example, my Xiaomi Phone has a Security app feature to enable/disable apps from auto-starting. It was blocking the FCM from restarting when the app is killed. I assume other android phones will have similar problems rooted from the Security feature that it is using.

himalayaahuja commented 6 years ago

Hi @kroikie I face the same issue , I need the notification to pop out and display when the app is killed or no longer active but only thing that happens is notification silently shows in systems tray and then i have to manually pull down to view it. what can we do about this? please help

kroikie commented 6 years ago

Hi @himalayaahuja if you are receiving the message but it is not displaying in they way that you want I would use a data-only message (no notification payload) and then in onMessageReceived I would build the notification locally.