android開機自啟動app示例分享
/*開機自動啟動APP*/
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("XRGPS", "BootReceiver.onReceive: " + intent.getAction());
if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent mBootIntent = new Intent(context, MainActivity.class);
mBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mBootIntent);
} else {
Log.w("XRGPS", "BootReceiver: unsupported action");
}
}
}
相關(guān)文章
Android開發(fā)中Google為什么不讓用Handler的runWithScissors()
這篇文章主要介紹了Android開發(fā)中Google為什么不讓用Handler的runWithScissors(),本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-09-09詳解Kotlin Android開發(fā)中的環(huán)境配置
這篇文章主要介紹了詳解Kotlin Android開發(fā)中的環(huán)境配置的相關(guān)資料,需要的朋友可以參考下2017-06-06Android ItemDecoration 實現(xiàn)分組索引列表的示例代碼
本篇文章主要介紹了Android ItemDecoration 實現(xiàn)分組索引列表的示例代碼,具有一定的參考價值,有興趣的可以了解一下2017-10-10Android ListView自動顯示隱藏布局的實現(xiàn)方法
這篇文章主要介紹了Android ListView自動顯示隱藏布局的實現(xiàn)方法的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-09-09