Reputation: 3
I have implement application using GCM to receive push notification from my server, It works exactly but i have a problem. When the app is not running i push a notification from server and i can not receive notification from GCM on device, it's OK. But when i open the app it still not receive the stored notification from GCM. Please give me some advice thanks.
Upvotes: 0
Views: 653
Reputation: 40734
When you manually stop/kill your app from the app settings screen you'll be in a state wherein GCM messages will still be delivered to the device, but your BroadcastReceiver
will not be able to receive the subsequent com.google.android.c2dm.intent.RECEIVE
broadcast. So what this means is the GCM message will essentially be lost. When you open up your app, you will not receive past GCM messages that you missed while your app was dead. There's no avoiding this if users are manually going into their settings and stopping your app.
Note that this is different from the case where you remove your app from the recent task/multitasking list - in that case any BroadcastReceivers
you have will still work, and you can either show a notification or perform some work at that time, and/or store something in persistence to be detected/used on the next time the user opens your app.
Upvotes: 0