There is the problem with android push notifications (GCM) on android 3.1 : when my app is CLOSED - broadcast receiver which should handle GCM push messages (Intents) is never called.
In lower versions of android everything works just fine. Broadcast reciever is always called (even when app is closed).
I know that from Android 3.1 there is new concept: when application is not running it is in "stopped" state: http://developer.android.com/about/versions/android-3.1.html#launchcontrols
So if you want to start "stopped" application via Intent - you should add FLAG_INCLUDE_STOPPED_PACKAGES flag to Intent.
But problem is that i can't add FLAG_INCLUDE_STOPPED_PACKAGES flag to GCM Intent because GCM Intents (i mean "com.google.android.c2dm.intent.RECEIVE" and "com.google.android.c2dm.intent.REGISTRATION") are thrown by the OS.
So my question is: how can i handle push messages (on android 3.1) from GCM via broadcast reciever in situation when application (in which broadcastreceiver is registered) is closed (is in "stopped" state) ?
how can i handle push messages (on android 3.1) from GCM via broadcast reciever in situation when application (in which broadcastreceiver is registered) is closed (is in "stopped" state) ?
You can't. If the user force-stops your app, nothing of your app will run again (on Android 3.1+) unless invoked manually, such as the user launching one of your activities. Your objective is to give the user no reason to force-stop your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With