Auto start application after boot completed in Android

前端 未结 5 875
时光说笑
时光说笑 2020-11-30 07:44

I want to make an application which has auto start option in its settings. I have made Settings activity in my application which is derived from PreferenceActivity and give

5条回答
  •  佛祖请我去吃肉
    2020-11-30 08:47

    final SharedPreferences sharedPreferences = getSharedPreferences("Application", MODE_PRIVATE);
            boolean isAutoStartEnabled = sharedPreferences.getBoolean("isAutoStartEnabled", false);
    
            if ( isAutoStartEnabled ) {
                startActivity(new Intent());
            } 
    

    I hope this helps you

提交回复
热议问题