Chirag Pipaliya
Chirag Pipaliya

Reputation: 1281

how i can start application info screen in android?

I want to start manage application (Settings -> Application -> manage application -> Application info) screen programmatically. I'm unable to do it. Can anyone please help me?

Thanks in advance.

Upvotes: 5

Views: 3397

Answers (2)

Paolo Rovelli
Paolo Rovelli

Reputation: 9684

From API Level 9 (Android 2.3) you can start an Intent with android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS. Thus:

packageName = "your.package.name.here"

try {
    //Open the specific App Info page:
    Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setData(Uri.parse("package:" + packageName));
    startActivity(intent);

} catch ( ActivityNotFoundException e ) {
    //e.printStackTrace();

    //Open the generic Apps page:
    Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
    startActivity(intent);

}

Upvotes: 4

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

as per this link

In Android 2.3, you can use startActivity() on an ACTION_APPLICATION_DETAILS_SETTINGS Intent, with a proper Uri, to bring up your app's "manage" screen

or

private static final String SCHEME = "package";

private static final String APP_PKG_NAME_21 = "com.android.settings.ApplicationPkgName";

private static final String APP_PKG_NAME_22 = "pkg";

private static final String APP_DETAILS_PACKAGE_NAME = "com.android.settings";

private static final String APP_DETAILS_CLASS_NAME = "com.android.settings.InstalledAppDetails";

public static void showInstalledAppDetails(Context context, String packageName) {
    Intent intent = new Intent();
    final int apiLevel = Build.VERSION.SDK_INT;
    if (apiLevel >= 9) { // above 2.3
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        Uri uri = Uri.fromParts(SCHEME, packageName, null);
        intent.setData(uri);
    } else { // below 2.3
        final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22
                : APP_PKG_NAME_21);
        intent.setAction(Intent.ACTION_VIEW);
        intent.setClassName(APP_DETAILS_PACKAGE_NAME,
                APP_DETAILS_CLASS_NAME);
        intent.putExtra(appPkgName, packageName);
    }
    context.startActivity(intent);
}

Upvotes: 4

Related Questions