Make an android app start when you start android


Hello, how are you? I am working on an app under android-studio. I want to make an option in my application that says "start when the device is turned on", that the application itself verifies if it starts when you turn on the computer and auto-tilde the option, otherwise no, that when it works, how can you give account, the application starts when android starts. Is this possible? I'm looking and I do not know how to do it thanks

asked by Bernardo Harreguy 02.12.2017 в 13:47

1 answer


What you need is to use a Broadcast Receiver that listens to this action    RECEIVE_BOOT_COMPLETED , with that it can be detected when the equipment   finished the restart.

I'll give you this sample code

You declare the following on your AndroidManifest:


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

Broadcast Receiver

    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <category android:name="android.intent.category.DEFAULT" />

Then you create your BroadCast Receiver

package tu.paquete;

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

public class TuBroadcastReceiver extends BroadcastReceiver {

    public void onReceive(Context context, Intent intent) {
        //cuando detecta la acción del reinicio completado, inicias tu activity
        if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
            Intent i = new Intent(context, TuActividad.class);


I leave an example link if you want: Take action after of the restart

answered by 02.12.2017 / 14:34