Yes, you need to request for permission android.permission.RECEIVE_BOOT_COMPLETED
, you have to declare it outside the <application> node of Android Manifest file as,
When the phone boots, an Intent is broadcasted to all apps who have registered to receive this Intent. To register for this Intent, like Imran said, you have to use BroadcastReceiver, first declare a receiver inside the <application> node as,
MyReceiver.java is the class that will receive the Intent. You will handle the Intent in the onReceive() method of BroadcastReceiver
class. You get approx. 5 secs to do what you want inside onReceive(), after that the system will show 'App not responding' dialog to the user, so make sure you don't do any heavy processing inside that method.