Android: Does BroadcastReceivers really stop if the application is killed?

If you declare BroadcastReceiver in AndroidManifest.xml, the receiver works as it should, even when the device boots up when my application is not already running, but if I force the application to stop from the settings, then the receiver seems to break too.
Could it be that the "Force stop" in Android 2.2 also does some cleanup after the application (including BroadcastReceivers or perhaps the alarms set by the application in AlarmManager, which should broadcast the intentions I receive)?
By the way, how can I see in Eclipse all the broadcasts sent to the device?

+4
source share
2 answers

Psycho

You cannot use Force Stop to attempt to test your application from a β€œnot working” state. I would say that the behavior is "undefined" at best. It is not uncommon that after using Force Stop in an application, you must manually reload it to get ANY of its usability (including BroadcastReceiver ). If your application can receive BroadcastReceiver events, including BOOT_COMPLETE Broadcast , you will not need to check it further.

I believe the goal of Force Stop was to completely stop the annoying functionality of the application. If an application runs in the background often because it receives a lot of broadcasts and restarts, would you think that Force Stop should prevent this behavior until the application is manually restarted by the user?

In addition, I do not believe that there is a way to view Broadcast events from Eclipse.

+3
source

There is no way in eclipse to see that a "broadcast has been sent"
In addition, if you registered the Broadcast in manifest for which you want to receive the event, the system will call the onReceived method

0
source

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


All Articles