方法来自网上,只作收集整理,以方便自己查询


1、提升服务的优先级 <intent-filter android:priority="1000">


2 、application标签中添加android:persistent属性


3、在service中重写onStartCommand方法, START_STICKY是service被kill掉后自动重写创建
return super.onStartCommand(intent, START_STICKY, startId);


4、 public void onDestroy() {
Intent ReIntent = new Intent();
ReIntent.setClass(this, MyService.class); //销毁时重新启动Service
this.startService(ReIntent);
}

更多相关文章

  1. WebView的使用,android与JS混编
  2. Building Custom Components/建立自定义组件
  3. Android获取应用运行次数
  4. Android中打开网络设置界面
  5. Android学习笔记(三):Andriod程序框架
  6. 使用IntelliJ IDEA(androidstudio前身)开发android移动应用前的基
  7. Android(安卓)-- 自定义View
  8. 关于android设备唯一区分device id的取得
  9. 【记录】Android(安卓)广播的发送与接收

随机推荐

  1. android windowManager
  2. Android(安卓)使用AsyncTask后台线程实现
  3. Android(安卓)自动编译、打包生成apk文件
  4. BitRaser for Mobile iOS和Android移动设
  5. Android智能硬件开发心得总结(一)
  6. 详解Android广播机制
  7. Android基础入门知识
  8. android 资源文件学习
  9. 丢失Android系统库或者Conversion to Dal
  10. Android(安卓)Bmob后端云—数据库、服务