Reputation: 623
Is it possible to call the BOOT_COMPLETED broadcastreceiver programmatically? I use it in the normal way but I want to execute it another time during runtime.
Upvotes: 0
Views: 39
Reputation: 8774
You can't send ACTION_BOOT_COMPLETED yourself. According to the docs:
"This is a protected intent that can only be sent by the system."
http://developer.android.com/reference/android/content/Intent.html#ACTION_BOOT_COMPLETED
You can of course send your own intent, and trigger the same code to be called.
Upvotes: 1
Reputation: 1007296
You are welcome to call sendBroadcast()
to trigger your own BroadcastReceiver
.
Usually, it is simpler just to have the common code -- needed both at boot time and at other times -- in some static method or helper class. Then, you do not need to actually call sendBroadcast()
, as you can just use the static method or helper class to do the work.
Upvotes: 1