How to list and monitor the apps that are installed and/or in use?

Asked

Viewed 760 times

6

On an Android device, where many app’s are running, I would like to enable an interface where the user can see which app’s installed and which ones are running at the moment, being possible to start, pause and uninstall an app.

  1. Where should I start?
  2. What classes, methods, or interfaces are responsible for listing app’s in order to track them?
  • 2

    Android is a system that cares a lot for stability and security, and so the possibility of closing application can already be discarded, the maximum you can is close background tasks (Activity Manager) pause I think it’s not as if not by the user himself and start you can take a look here: http://stackoverflow.com/questions/3872063/launch-an-application-from-another-application-on-android I believe that a complete reference to what you can do is the Activity Manager: http://developer.android.com/reference/android/app/ActivityManager.html

  • 1

    See installed apps, stop them and uninstall them you can do by option Configurações > Aplicativos. Other than that, I think that only with a "rooteado" device it would be possible to create another application to do the same.

  • 2

    "Android is a system that values stability and security"...

2 answers

3


  1. As is response in SO-en the method should be called so (ACTION_UNINSTALL_PACKAGE is only available in API level 14):

    Uri packageUri = Uri.parse("package:org.PACOTE");
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);
    startActivity(uninstallIntent);
    
  2. (Up to the Level 20 API) To list applications that are running (or have been running recently), as is so-en response the code should be something like:

    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final List<RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
    
    for (int i = 0; i < recentTasks.size(); i++)  {
        Log.d("Aplicativo executado", "Aplicativo: " + recentTasks.get(i).baseActivity.toShortString() + "\t\t ID: " + recentTasks.get(i).id);
    }
    
  3. For API Level 21 use getAppTasks

-1

  • 1

    that link talks about answers that contain basically links, it would be nice to take a look at it, on meta has many things that can help us to make Sopt better and better

Browser other questions tagged

You are not signed in. Login or sign up in order to post.