-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
onMessageRecieved not working when app is killed. #368
Comments
Now (for APP IS CLOSED case) I write Notification text to file and read this text if extras == null and notificationText.txt is exists... its stupid solution but it works. How can I catch this extras when app is closed in other way?(( |
Hello guys <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> My app received notifications when is foregorund, background and is closed. |
Hi @DanikKamilov and @carlosalexandresmo FCM does not process messages if an app is "killed" or force stopped. When a user kills an app it is an indication that the user does not want the app running so that app should not run till the user explicitly starts it again. Note that swiping an app from recents list should NOT "kill" or force stop it. If messages are not being received after swiping from recents list then please identify these devices and we will work with the manufactures to correct this behaviour. Only being able to handle messages when the app is in the foreground or background is working as intended. |
@kroikie Are you guys keeping a running list of devices with this problem, and if so can you make it public? |
Hi @kroikie on messageReceived is not getting called for the below FCM when the app has been removed from recents by swiping on devices manufactured by VIVO, ONE PLUS. PLease |
@Adityavns try adding these two permissions also in manifest "uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" I also have oneplus 3 mobile and i was having same issues ,but after adding the permissions my issue got resolved. |
Hi Raj,
Thanks for the reply! It is still not working in Vivo and one plus 5 phones
that i have tested.
Regards,
Aditya Vns
…On Wed, Dec 6, 2017 at 5:06 PM, rajeshjakhar1092 ***@***.***> wrote:
@Adityavns <https://github.com/adityavns> try adding these two
permissions also in manifest
"uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"
"uses-permission android:name="android.permission.WAKE_LOCK"
I also have oneplus 3 mobile and i was having same issues ,but after
adding the permissions my issue got resolved.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#368 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGEyDnSee13lT7lsO7A_fZJi429_m6a0ks5s9nxTgaJpZM4QSHEZ>
.
--
aditya369
|
@Adityavns yeah you are right ,actually i am now again facing the same issue, I still not able to figure out what is the main issue, actually I have a app in which i have implemented the same code and there I am getting notifications all the time even app is killed... but in another app it is not working.. I will let you know if I get a solution :) Regards |
@Adityavns please let me know also if you find any solution. Regards, |
@Adityavns try this one, go to settings in battery>> battery optimization>>select your app>>you will see that your app is optimised>>> click on dont optimise>> then try pushing notificaiton.... hope this helps. Please let me know if this works... Regards |
@Adityavns It is because of DOZE mode and battery optimisation,you just have to turn off battery optimisation for all apps or particular app. Regards |
As @kroikie said this is intended behavior, although we are still interested to know when developers run into it. If you find devices that you think behave strangely please continue to tell us. I am going to close this issue as there's nothing we can do to "fix" it besides continuing to discuss new places you find it, |
List of devices: OnePlus, Oppo, Lenovo |
Same issues with asus a007 zenphone!! |
@kimnamcham It is because of DOZE mode and battery optimization,you just have to turn off battery optimization for all apps or particular app. Go to Settings>> apps >> select your app>> battery>> I have OnePlus 3 and I had the same issue . I did this and my problem was solved. battery optimization blocks incoming notifications from apps so that the wont kill battery. Thanks Regards |
@rajeshjakhar1092 We all know this. You should read the whole thread. |
@kimnamcham This is not solution. There are apps like Whatsapp, iMobile, Facebook,etc which is set to "optimise" in Battery Optimisation Setting but still it gets notification without missing any. @samtstern @kroikie It can't be intended behaviour if other apps in background still gets notifications. Something bug with firebase push notification sdk. I tested with firebase 4.5 package using unity. Not working on Oneplus 5. |
how to handle notification when app in kill in firebase android |
is this issue resolved? |
No. Google developers closing issue without solution on there own OS. |
i am getting this issue on staging app on live it is working fine. might be my app is white listed when it goes live. |
even though opmization is enabled apps like whatsapp recieve message when in background and after being swiped out. Any solution for an app targeting oreo ? |
Solution plz sir?..... |
|
@rameshvoltella outside has 2 meanings.
In 1. case we deliver the notification. From Android docs:
We do not add the |
I getting notification in background , open, resume mode in all devices very well. Please suggest and coordinate me , |
@iwwBittu there was no change after lollipop on how messages are handled after swiping away an app from the recents menu. Same code should work. Could you file a ticket with our support team since this may be a device specific issue. |
Any solutions for infinix or different chinese devices? |
I have the same problem, and in 2020 there is still no solution for that ?? a shame for google. |
as mentioned by @kroikie many times here, vendors have not implemented swipe-up from recents correctly. I have seen this issue in Lenovo Vibe K5 Plus, few apps are whitelisted by vendor. There is restrict-to-launch checkbox in app management. for well-known apps it is unticked. If I download whatsapp, it is unticked by default. for our app it is ticked, so FCM is not getting delivered after swipe-up. If I untick it, FCM works, but who will educate this to users :) |
Hi, when I call ##426## on my phone, I see the screen with logs of notifications. In this screen shown that firebase delivered notifications, but android can't broadcast stopped app. So I think this is not a problem of firebase. Maybe it is helps someone to understand how to solve this issue. |
Can confirm that this issue is reproducing for me on Update |
Has this issue been fixed after 3 years? Or any work around? |
Not fixed |
Tested on a production app, over 100+ devices. Just don't Pass the "Notification" object . What I am doing? check this cloud function FirebaseService in manifest
Don't forget to subscribe topic "all" , for the above code snip. This is what working for me. |
@satyajiit my message is |
same issue, any solution for infinix? |
same issue did you find any solution? |
finally issue resolved just follow below code it is working fine on oneplus huawei and infinix
|
Kotlin version with broadcast would be:
|
Sometimes |
I tried adapting this code for Xamarin, but was unable to get it to work, still not receiving the push notification when app is closed on Infinix. @Waleedasim if you don't mind, can you give any other pointers that might be helpful. Thanks |
If someone is looking for a detailed explanation please visit: https://github.com/shahzadafridi/FCM-Notification-Test-Cases I am sure this will helps you. |
Anyone with any working solution |
@google decided to do nothing, it left us with this problem alone |
Lets get one thing cleared! |
Also, did you guys check this out? https://firebase.google.com/docs/cloud-messaging/android/receive |
App state | Notification | Data | Both |
Hi there, |
I have one App which is on Play Store it receives the notification but the App which is in development process not getting I think after publishing it on the store it will also work. |
For me in Xcode ı Fix it ruunner >Sign &Capabitlies cheack All - Debug-Release-Profile to be same bundle id and for all accept push notificaiton this was my problem and take my 5 days |
why this issue is closed , any solution for this issue? |
onMessageRecieved not working when app is killed. It works perfect in foreground and in background and I can receive Extras in MainActivity. But when app is killed I receive notification and after click on it- Extras == null.
I send only DATA (to, data) notification. What I do wrong?
`
@OverRide
public void onMessageReceived(RemoteMessage remoteMessage) {
}
}
`
and I've tried to use different flags in intent and pending intent and it not works... (I can't catch intent.putExtra("notification",messageBody); in MainActivity when app is closed.)
The text was updated successfully, but these errors were encountered: