手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android开机自启动app示例分享
android开机自启动app示例分享
摘要:复制代码代码如下:/*开机自动启动APP*/publicclassBootReceiverextendsBroadcastReceiver{...

复制代码 代码如下:

/*开机自动启动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");

}

}

}

【android开机自启动app示例分享】相关文章:

Android屏蔽后退键的小例子

Android UI开发 View自绘控件 分享

Android 自动化测试经验分享 深入UiScrollable

Android应用程序的调试

android开机自启动原理与实现案例(附源码)

android生命周期深入分析(二)

android TextView属性的详细介绍 分享

Android三种菜单实例分析

android 搜索自动匹配关键字并且标红

Android重启运用程序的代码

精品推荐
分类导航