Gets all running services. - Android App

Android examples for App:Service

Description

Gets all running services.

Demo Code


//package com.java2s;
import android.app.ActivityManager;

import android.content.Context;
import java.util.List;

public class Main {
    /**/*from   ww w  .  ja va2s. c  o m*/
     * Gets all running services.
     */
    public static List<ActivityManager.RunningServiceInfo> getRunningServices(
            Context context) {
        ActivityManager am = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        return am.getRunningServices(Integer.MAX_VALUE);
    }
}

Related Tutorials