Reputation: 41
I am currently developing an Android app which uses Firebase Messaging to receive notifications from the server.
It works fine on most of the devices but on some devices such as my Oneplus 3, when i restart the device and do not open my app after restart it starts missing notifications and when i open the app it only receives notifications sent after opening the app.
The following message shows in the logcat when i send notifications during the time when app is not opened after restart.
This is the message in the logcat:
W/GCM-DMM: broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.website.app (has extras) }
The same message is received in logcat when app is force closed.
I can request users not to force stop but how can i stop them from rebooting their device. Therefore I request a help from stackoverflow community in this context. Is there any way i can know that app has missed some messages while it was closed?
Upvotes: 4
Views: 2924
Reputation: 2709
Some devices have a vendor specific way of stopping apps that are not mainstream from being awakened by push notifications thereby not receiving in dead state.
Confirm if this is the case by looking for protected apps
in that device and tap allow
to start receiving push notifications in dead state.
Devices that I have encountered with this issues are:- Techno
, Infinix
Huawei
e.t.c
Upvotes: 1
Reputation: 8102
You may want to try this solution in this related SO post which is by defining enabled and exported with values set to true
.
Here's the code given in the post:
<service
android:name=".MyFirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
Upvotes: 0