title: Check if service is running on Android?
body: <p>l want to check if a service is running
  l wrote this code</p>
  
  <pre><code>public class startServiceOrNo {
  public static void startServiceIfItsNotRuning(Class&lt;?&gt; class1, Context context) {
      ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
      for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
          if (class1.getName().equals(service.service.getClassName())) {
              Lg.d("servisstart SERVICE ALREADY START" + class1.getName());
              return;
          }
      }
      Lg.d("servisstart SSERVICE NEW SERVIS " + class1.getName());
      context.startService(new Intent(context, class1));
  }
  </code></pre>
  
  <p>and use it 
   startServiceOrNo.startServiceIfItsNotRuning(OfflineChopsMonitor.class,this)</p>
  
  <p>if l check service from one class its work, but if l check same service from different class, its check don't work </p>