android开机自启动,service
来源:互联网 发布:酒店业数据 编辑:程序博客网 时间:2024/06/09 23:54
if(inta.getAction().equals("android.intent.action.BOOT_COMPLETED")){/*Intent startIntent = new Intent(arg0,MainActivity.class);startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); arg0.startActivity(startIntent); */Intent startIntent = new Intent(arg0,MQService.class);startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //启动新任务arg0.startService(startIntent);}
1.注册Reciever 接收Android开机消息 BootBroadcastReceiver
2.AndroidMainifest.xml中注册
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
注册Receiver接收器
<receiver android:name="com.rabbitmq.mqforward.BootBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
0 0
- 【Android】开机自启动Service
- 【Android】开机自启动Service
- 【Android】开机自启动Service .
- Android Service 开机自启动
- 【Android】开机自启动Service
- android开机自启动service
- android开机自启动,service
- android 开机自启动:启动activity、service
- android应用开机自启动&service开机自启动
- Android实现开机自启动Service
- Android实现开机自启动Service
- Android实现开机自启动Service
- Android 实现开机自启动 Service
- Android实现开机自启动Service
- Android实现开机自启动Service
- android 开机自启动一个service
- Android实现开机自启动Service
- Android如何实现开机自启动Service
- Swift-数组
- NYOJ 349 Sorting It All Out
- Linux 常用命令
- MyEclipse中如何去掉JS/JSP语法错误提示
- 各种特效集合
- android开机自启动,service
- Gson原理简析
- vs2015 LINK : fatal error LNK1104: cannot open file 'ucrt.lib'
- NYOJ 20 吝啬的国度
- glBlendFunc();--混合
- 特效集合
- Apache Solr:全文搜索
- CentOS 7 中,创建桌面快捷方式
- BAT解密:互联网技术发展之路(9)- 业务层技术剖析