展会信息港展会大全

android开发开机启动应用的实现代码
来源:互联网   发布日期:2016-01-19 12:29:55   浏览:1775次  

导读: *开机自动启动APP* public class BootReceiver extends BroadcastReceiver {12@Overridepublic void onReceive(Context context, Intent intent) {;Log d(XRGPS, BootReceiver onReceive: + ...

/*开机自动启动APP*/

public class BootReceiver extends BroadcastReceiver {

1

2

@Override

public void onReceive(Context context, Intent intent) {

;

Log.d("XRGPS", "BootReceiver.onReceive: " + intent.getAction());

if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {

1

2

3

4

5

6

7

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开发

相关内容
AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港