To start an android background service when the device boots, you should create a broadcast receiver, and make it listen to android.intent.action.BOOT_COMPLETED action. Then in the custom broadcast receiver’s onReceive method, you can start the background service.
This example will show you how to implement force log out when the same user account login in another instance of the same android app. It will use both android Activity, Service, and Broadcast Receiver components to implement.
Android global broadcast makes different android apps’ communication easy and clear, but it also has below security issues. Any android apps can send the same broadcast intent action which your application broadcast receiver listens. This issue can make your app being attacked. Any android apps can listen to your app’s broadcast receiver registered action. So …
This article include examples about how to create and send custom normal or ordered broadcast. It also illustrate how to abort the broadcast in the ordered broadcast receiver chain. If you do not know about android broadcast, you can read Android Broadcast Overview or Android Broadcast to learn.
In some cases, you may need to create a broadcast receiver that can still run in the background after the android app exit. This example will just tell you how to do that use a broadcast receiver and android service object.
In the previous article, we have learned how to dynamically register and unregister the android broadcast receivers in java code. This example will show you how to register the android broadcast receiver statically in the android manifest XML file.
This example will show you how to dynamically register/unregister broadcast receivers in android activity. You can read the article Android Broadcast Overview to learn basic concepts about android broadcast if you need.
Android applications use broadcasts to communicate with each other. Broadcasts can be sent by either the android system or other applications. Each android application can register it’s interesting broadcast, then it will only receive the interested broadcasts that have been registered.