Android Start Service on Boot Automatically

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Android Start Service on Boot Automatically (Autostart Android Application)

Here we will learn about Android Start Service on Boot Automatically (Autostart Android Application). That means we will learn the simplest way to start an Android service or an application at device boot up. It is very simple. First we will register an Android event called ‘android.intent.action.BOOT_COMPLETED’. Then we will capture this event when boot up completed and start our service. Then we will start our app from the service.

Step 1:

First we need an Android  service to started at device boot up. Your service looks like below. If you are new to Android service then i recommend you to learn about simple Android service with example. I have written a very nice article on Android Services.

import android.os.IBinder;
import android.content.Intent;

public class AndroidStartServiceOnBoot extends Service {

public IBinder onBind(Intent intent) {
return null;

public void onCreate() {
// do something when the service is created

Step 2:

Now we need a class which extends from BroadcastReceiver class. In this class there is a method called onReceive() that will be called when the boot event is completed. From the onReceive() method we will start the Android service which we have just created in above step 1.

import android.content.Context;
import android.content.BroadcastReceiver;
import android.content.Intent;

// here is the OnRevieve methode which will be called when boot completed
public class BootCompleted extends BroadcastReceiver{
public void onReceive(Context context, Intent intent) {
//we double check here for only boot complete event
//here we start the service
Intent serviceIntent = new Intent(context, AndroidStartServiceOnBoot.class);

Step 3:

Now We need do 3 things in Android Manifest file.

1. Add the permission in Manifest file to capture the boot complete event.

<uses-permission android:name=”android.permission.RECEIVE_BOOT_COMPLETED”/>

2. Register your BroadcastReciever class in Manifest file to receive the boot complete event.

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

<action android:name=”android.intent.action.BOOT_COMPLETED” />

3. Register your Service class in Manifest File which we need to start when boot completed.

4. Your Manifest file looks like below.

Note: The above Manifest file is just an example for Android Start Service on Boot Automatically.

 Step 4: Start Android Application at Device boot up.

Now if you want to start (launch) an Android activity at device boot, then start the activity from the service instead of start it from the receiver.


  • The onReceive() function in the receiver class expire with in 8 seconds, if you will do any time consuming task or waiting more than 8 seconds in onReceive() function, then your application will crash with ANR. So better to start a service and from the service you can do a time consuming task.

I hope this small tutorial on ‘Android Start Service on Boot Automatically‘ will help you at it’s best.