Android check if a particular service is running

public static boolean isAppRunning(final Context context, 
              final String packageName) {

  final ActivityManager activityManager = 
       (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

  final List<ActivityManager.RunningAppProcessInfo> procInfos = 

  if (procInfos != null)
    for (final ActivityManager.RunningAppProcessInfo processInfo : procInfos) {
      if (processInfo.processName.equals(packageName)) {
        return true;
  return false;

In my case packageName was` ​com.example.myService:qt`


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s