2012. 8. 3. 22:52

서비스를 띄우고 액티비티가 종료시 다시 띄울때 서비스를 체크해 줘야 한다.


private Boolean isServiceRunning(String serviceName) {

ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo runningServiceInfo : activityManager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceName.equals(runningServiceInfo.service.getClassName())) {
return true;
}
}
return false;


Posted by k1rha