Does a power stop make the application receiver not called?

I have a service declared in XML that responds to a PACKAGE_ADDED translation destination. It works fine, but I just found out that if I force the application to stop, the receiver will not get anything else. This is not called.

This is normal? What can I do?

I need to make sure that he always answers.

+4
source share
3 answers

Starting with version 3.1 of the Android application, the can not application receives a broadcast of intentions until it watches manually once. Before the first launch, the application is considered β€œstopped” by the launcher. ( http://developer.android.com/about/versions/android-3.1.html in the section "Running controls on stopped applications").

If you manually force the application to stop, this flag will be set again, and you need to restart it manually to allow it to receive events again.

+1
source

Try adding FLAG_INCLUDE_STOPPED_PACKAGES

This FLAG is your intention.

+1
source

If your receiver is dynamically registered by your service when it is killed, the receiver also. But if you declare your receiver in XML, this should work. (Like a regular boot receiver)

0
source

Source: https://habr.com/ru/post/1487619/


All Articles