Hi I’m writing a application for android that is started from boot up and i wondered if there was a way of telling the application it was started from the boot up of the device? i need it to do something different if the application was manual started (i.e not when the device was started). i am using a BroadcastReceiver to start the application when the device starts.
Share
You could either make two different broadcast receivers one that has
ACTION_BOOT_COMPLETEDfor the intent filter, and another that has the other intent filter that you would use.Or create one broadcastreceiver that has two intent filters like:
and then in the
onReceiverdo:EDIT:
The above assumes that you use the
BroadcastReceiverunder two circumstances, which may not be the case judging from your question.So if you are starting an
Activity(or service), then in theBroadcastReceivercode, you could do:Then in the activity, you could do:
Let me know if I need to add anything.