I have a service declared in XML that responds to PACKAGE_ADDED
broadcast intent.
It works fine, but I just found out that if I force stop the app, the receiver won't receive anything anymore. It's not being called.
Is this normal? What can I do?
I need to make sure it always responds.
Since version 3.1 of Android an application cant receive broadcast intents until its stared once manually.
Before the first start, the application is considered as "Stopped" by the launcher. (http://developer.android.com/about/versions/android-3.1.html under "Launch controls on stopped applications").
If you manually force stop the application, this flag will be set again and you need to relaunch it manually to allow it to receive the events again.
Try add FLAG_INCLUDE_STOPPED_PACKAGES
this FLAG
in your Intent.
If your receiver is registered dynamically by your service, when he is killed the receiver is also.
But if you declare your receiver in XML this should work. (As usual boot receiver)