Android Question How to open the Application Info screen

NeoTechni

Well-Known Member
Licensed User
Longtime User
Given a PackageName, how do I open the system's app info screen?

I found this java code, but I don't know how to translate it into B4A, and I'd prefer not to have write a library for it.
B4X:
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);
 

NJDude

Expert
Licensed User
Longtime User
Try this:
B4X:
Dim p As Phone
Dim i As Intent
Dim PackageName As String

PackageName = "<YOUR_PACKAGE_NAME>"

If p.SdkVersion > 8 Then

   i.Initialize("android.settings.APPLICATION_DETAILS_SETTINGS", "package:" & PackageName)
			
Else			

   i.Initialize("", "")

   i.SetComponent("com.android.settings/.InstalledAppDetails")
   i.PutExtra("pkg", PackageName)

End If

StartActivity(i)
 
Last edited:
Upvote 0
Top