Android自启动管理
2016-06-10 18:06
288 查看
<span style="font-size:14px;">public class bootReceiver extends BroadcastReceiver { //要在清单文件中添加这个权限:android.permission.RECEIVE_BOOT_COMPLETED //同时在清单文件中给receiver添加这个过滤的action private static final String ACTION = "android.intent.action.BOOT_COMPLETED"; @Override public void onReceive(Context context, Intent intent) { if (ACTION.equals(intent.getAction())) { //在此启动本应用的关键性服务 Intent intnt = new Intent(Intent.ACTION_RUN); intnt.setClass(context, startService.class); context.startService(intnt); } } } //startService中编写具体的逻辑事务,这里就不做赘述了</span>
相关文章推荐
- 解决Genymotion中的unknown generic error错误以及无法联网下载Android虚拟设备
- Android intent flag启动模式
- 收藏了几个学习android+h5混合开发用得到的博客
- android—Compiling with Jack—Jack is a new Android toolchain
- android文件下载自动安装或打开
- android中获取布局文件的三种方法
- 【自定义View】01--常用工具介绍
- Android Studio教程(二)之AS的安装和配置目录介绍
- Android Studio教程(一)之AS的安装教程
- Android之GLES2.0显示立方体各面不同图片测试代码2
- 国内技术社区活跃的 Android 大神汇总
- 【Android】Activity入门
- Android View 测量参数
- Android View中重要的回调方法
- android 自定义View基础(1)
- 玩转Android之调试应用
- 玩转Android之如何处理返回按钮
- Splash的实现
- 如何设定Android Activity间切换时的动画
- Android_Service