Android Auto Launch Application at Boot Time

You may noticed, on your device some of the applications launched automatically while your device boot completely. Like, your email app or any chat application.
But how it works…?
In this article, I am going to show you, how we can auto launch application at boot time. So, let’s see.
Create new class named “AutoLaunch.java” and extend it by “BroadcastReceiver” as base class.
Note: You must register BroadcastReceiver under AndroidManifest.xml.
See the code Illustrated below.

Now when your device boot, it will fire broadcast receiver and call onReceiver() method of the class. Inside the onReceiver() method, use the Intent object to start another Activity which you want to launch at first Or you may use some think else which you want.
Note: You must add the FLAG _ACTIVITY_NEW_TASK flag to the Intent object.
Now register the broadcast receiver under application node into AndroidManifest.xml. Also add RECEIVE_BOOT_COMPLETED permission.
See the receiver node added into AndroidManifest.xml below.

Your application is ready to run.

Android Auto Launch Application at Boot Time

Download Source

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *