automatically run an application on Android phone startup

后端 未结 4 1423
一整个雨季
一整个雨季 2020-12-18 16:59

I want to start my application when phone startup

I just follow tutorial from here but it doesn\'t work in my device. Please see my method:

public c         


        
4条回答
  •  青春惊慌失措
    2020-12-18 17:32

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
                context.startService(new Intent(context, BootService.class));
            }
        }
    

    and next you should implements BootService class extended Service

提交回复
热议问题