8

I need to know why my app didn't run immediately after booting in android real phone? My app runs but after a few second of booting.

My Code is

public class AutoStart extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
         if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
                Intent i = new Intent(context, MyActivity.class);
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(i);
            }
    }

}

My activity is running, but after few Seconds of the boot completed. Is it Possible to reduce this few second?

I want to run my app immediately. I Don't want to allow user to access the phone.

4

3 に答える 3