[url]http://www.blogjava.net/jjshcc/archive/2012/04/13/373827.html[/url]
已试用,可行。
android如何让service不被杀死
[url]http://www.eoeandroid.com/forum.php?mod=viewthread&tid=169411[/url]
已试用,可行。
private boolean isServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if ("com.example.MyService".equals(service.service.getClassName())) {
return true;
}
}
return false;
}
android如何让service不被杀死
[url]http://www.eoeandroid.com/forum.php?mod=viewthread&tid=169411[/url]