We have BroadcastReceiver to listen to the system events. There are receivers like BOOT_COMPLETED, SCREEN_ON, USER_PRESENT which we can register to perform any specific task when phone boots or screen unlocks. The same we are using here to Launch our Android application on phone unlock and boot.
Firstly, as mentioned above, we have to register the receivers that we want our application to listen to. So we register receivers in AndroidManifest.xml like: