check service is running or not
<p>I Have a service that when i start it, schedule with alarm manager to run on 00:00,
i want check that my service is running or not ?</p>

<p>when i check in Settings -> Applications -> Running Tasks, My Service Exist In Cached Process so below code is not working, because my service noting in running service, can any one help to me ?</p>

<pre><code>private boolean isServiceRunning(String serviceName) {
        ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
        List&lt;ActivityManager.RunningServiceInfo&gt; l = am.getRunningServices(50);
        Iterator&lt;ActivityManager.RunningServiceInfo&gt; i = l.iterator();
        while (i.hasNext()) {
            ActivityManager.RunningServiceInfo runningServiceInfo = (ActivityManager.RunningServiceInfo) i.next();
            if( runningServiceInfo.service.getClassName().equals(serviceName) ) {
                return true;
            }
        }
        return false;
    }
</code></pre>
