16

I want to access and see how many and which services are running in background.

I want the exactly same functionality as we can access by

Menu->Setting->Applications->Running Services

on our android base mobile phones or tabs. Can anybody tell me what function or classes have been used in android source code to provide this functionality.

And if there is any way by which i can access this in-build list of background running services which i have mentioned above then please do tell me because its better for me to use in-build one instead of creating the whole new one.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Varundroid
  • 9,135
  • 14
  • 63
  • 93
  • http://varundroid.blog.com/2011/05/22/androidscreens/ I don't know this solution is right or wrong but it works fine for me. – Varundroid May 24 '11 at 07:57

5 Answers5

15

Check This Link:

How to Access Android’s List of Running Apps in 6.0 Marshmallow and Above


Where to Find Running Services in Android 6.0 Like I noted earlier, on

Android 5.x and below, you could see what was going on by jumping in Settings > Apps > Running. This shows both running processes and services, along with how much memory (RAM) is being used by System and Apps, as well as how much is still available.


To find the same menu in Marshmallow, you’ll first need to enable Developer Options. Do this by heading into Settings, then About Phone.


Once there, find the Software info section—that will be a separate entry on some phones (Samsung, LG), but not on others, like Nexus devices. You’re looking for the Build Number, so you may have to poke around a bit before you find it. The first two images below were taken from the Samsung Galaxy S7 Edge, and the last one from the Nexus 6P. As you can see, the build is in two different places.



When you’ve found it, tap it seven times. You’ll see a toast notification letting you know how many are left until “you become a developer.” Once it’s been tapped seven times, a new menu will be unlocked just above About Phone in the main Settings menu.


Back in Settings, head into Developer Options. You should see “Running services” a little way down this menu—that’s what you’re looking for. Once you tap “Running services,” you should be presented with a familiar screen—it’s exactly the same one from Lollipop. Just in a different spot.


sourcejedi
  • 3,051
  • 2
  • 24
  • 42
Iman Marashi
  • 5,593
  • 38
  • 51
7

Here is a complete answer.

Step 1. First you need to declare and initialize few variables :-

private static final String APP_DETAILS_PACKAGE_NAME = “com.android.settings”; // Here you need to define the  package name

private static final String SCREEN_CLASS_NAME = “com.android.settings.RunningServices”; // Here you need to define the class name but NOTICE!! you need to define its full name including  package name.

Step 2. Instantiate an Intent

Intent intent = new Intent();

Step 3. Set Action to ACTION_VIEW

intent.setAction(Intent.ACTION_VIEW);

Step 3. Set class name inside the intent as we know that package can have more than one activity. So Intent needs something to match the Activity inside the package name.

intent.setClassName(APP_DETAILS_PACKAGE_NAME,  SCREEN_CLASS_NAME); //Here you need to set package name as well as class name so it could refer to the Package and IntentFilter of the given Activity.

Step 4. Start the Activity

context.startActivity(intent); // As soon as this line will be executed Running Service screen will be displayed as a foreground activity.

In above example if you want to access some different screen then change the APP_DETAILS_PACKAGE_NAME and SCREEN_CLASS_NAME as per your need.

I really don't know that this method is documented or not but it works like charm for me.

Varundroid
  • 9,135
  • 14
  • 63
  • 93
  • Does this method work for all android versions or only below 2.2 (Froyo) if so, do you know a way to implement this for 2.3+? Thanks. – user959631 Jan 28 '13 at 22:57
  • Ahh, ok, thanks, how would I make it display my app's running process/services rather than all services? Any ideas? Is it possible to do that? – user959631 Jan 29 '13 at 22:50
3

simple steps

  1. turn on develop mode on your device
  2. go to develop settings and try to find "running services"
  3. as a result you will get list of run services
Sergei S
  • 2,553
  • 27
  • 36
2

You check in your device

1- Go to mobile setting 2- Click on Application manager 3- Slide left to see running applications

This is the place where you'll find running application along running services as shown in attached image:

enter image description here

A.Aleem11
  • 1,844
  • 17
  • 12
2

Presumably, it is calling getRunningServices() on ActivityManager. There is no documented Intent to go straight to that screen.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • i just checked over internet that there are few apps in market like "Advance Task Manager" which access that screen directly by one click so it means they did make a call to the exact same function as android do when we click on Running Services. – Varundroid Apr 02 '11 at 14:54
  • 3
    @Varundroid: That's nice, but it is not documented or supported, and so you (and they) should not be using it. The closest that is documented and supported is `ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS` on `android.provider.Settings`. – CommonsWare Apr 02 '11 at 14:58