1. settings 中stop service
onDestroy方法中,调用startService进行Service的重启。
2.settings中force stop 应用
捕捉系统进行广播(action为android.intent.action.PACKAGE_RESTARTED)
3. 借助第三方应用kill掉running task
提升service的优先级
private void initNotify() { Notification notification = new Notification(R.drawable.ic_launcher, getText(R.string.ticker_text), System.currentTimeMillis()); Intent notificationIntent = new Intent(this, StartActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent); this.startForeground(R.drawable.ic_launcher, notification); }
开机启动问题:
http://blog.csdn.net/flying_vip_521/article/details/7053355
还有在4.0以下监听电池电量变化,检测服务是否被关闭 关闭了就打开
4.0以上就是订一个闹钟检测就可以了