Example usage for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS

List of usage examples for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS

Introduction

In this page you can find the example usage for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS.

Prototype

String ACTION_APPLICATION_DETAILS_SETTINGS

To view the source code for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS.

Click Source Link

Document

Activity Action: Show screen of details about a particular application.

Usage

From source file:dev.ukanth.ufirewall.Api.java

@SuppressLint("InlinedApi")
public static void showInstalledAppDetails(Context context, String packageName) {
    final String SCHEME = "package";
    final String APP_PKG_NAME_21 = "com.android.settings.ApplicationPkgName";
    final String APP_PKG_NAME_22 = "pkg";
    final String APP_DETAILS_PACKAGE_NAME = "com.android.settings";
    final String APP_DETAILS_CLASS_NAME = "com.android.settings.InstalledAppDetails";

    Intent intent = new Intent();
    final int apiLevel = Build.VERSION.SDK_INT;
    if (apiLevel >= 9) { // above 2.3
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Uri uri = Uri.fromParts(SCHEME, packageName, null);
        intent.setData(uri);/*from w  w  w .j  a v a 2s .  c  om*/
    } else { // below 2.3
        final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22 : APP_PKG_NAME_21);
        intent.setAction(Intent.ACTION_VIEW);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClassName(APP_DETAILS_PACKAGE_NAME, APP_DETAILS_CLASS_NAME);
        intent.putExtra(appPkgName, packageName);
    }
    context.startActivity(intent);
}