android自启动app android开机自启动app示例分享
人气:0想了解android开机自启动app示例讲解的相关内容吗,在本文为您仔细讲解android自启动app的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:开机自启动,启动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");
}
}
}
加载全部内容