To start an android background service when device boot, you should create a broadcast receiver, and make it listen 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 logout when same user account login in another instance of same android app. It will use both android activity, service and broadcast receiver components to implement.
Android global broadcast make different android apps communication easy and clear, but it also has below security issues. Any android apps can send same broadcast intent action which your application broadcast receiver listen. This issue can make your app being attacked. Any android apps can listen to your app’s broadcast receiver registered action. So your …
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 which can still run at the background after the android app exit. This example will just tell you how to do that use broadcast receiver and android service object.
In previous article we have learnt how to dynamically register and unregister android broadcast receiver in java code. This example will show you how to register android broadcast receiver statically in android manifest xml file.
This example will show you how to dynamically register / unregister broadcast receiver in android activity. You can read article Android Broadcast Overview to learn basic concepts about android broadcast if you need.