How to show information about an installed application on Android?

I am writing an application to list the applications installed on the system. I use PackageManager and queryIntentActivities () to get a list of applications.

I can start it, delete it (using ACTION_DELETE), but I have no idea how to show the details (where the user can force stop, go to / from the SD card, see the use of disk space, etc.)?

I tried ACTION_VIEW, but it also shows the uninstall dialog in 2.1 (has not tested other versions yet). I also did not find anything but an unanswered question on the android-dev mailing list.

+5
source share
3 answers

API 9 (a.k.a., Android 2.3), ACTION_APPLICATION_DETAILS_SETTINGS . Android .

+3

http://groups.google.com/group/android-developers/browse_thread/thread/1d4607eb370b1fe6/3cd4b85c310fe112?show_docid=3cd4b85c310fe112&pli=1:

    Intent intent;

    if (android.os.Build.VERSION.SDK_INT >= 9) {
        /* on 2.3 and newer, use APPLICATION_DETAILS_SETTINGS with proper URI */
        Uri packageURI = Uri.parse("package:" + pkgName);
        intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", packageURI);
        ctx.startActivity(intent);
    }  else  {
        /* on older Androids, use trick to show app details */
        intent = new Intent(Intent.ACTION_VIEW); 
        intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); 
        intent.putExtra("com.android.settings.ApplicationPkgName", pkgName); 
        intent.putExtra("pkg", pkgName); 
        ctx.startActivity(intent);          
    }
+8

try it

public static void openAppInfo(Context context, String packageName)
{
    try 
    {
        //Open the specific App Info page:
        Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + packageName));
        context.startActivity(intent);
    } 
    catch ( ActivityNotFoundException e ) 
    {
        //Open the generic Apps page:
        Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
        context.startActivity(intent);
    }
}
0
source

All Articles