技术小黑屋

Start InstalledAppDetails Activity With a Specific Package Name

This trick works. It’s really easy.

1
2
3
//Let take com.mx.browser as the package name
Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:com.mx.browser"));
startActivity(intent);

Here is the javadoc of android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS

Activity Action: Show screen of details about a particular application.
In some cases, a matching Activity may not exist, so ensure you safeguard against this.
Input: The Intent’s data URI specifies the application package name to be shown, with the “package” scheme. That is “package:com.my.app”.
Output: Nothing.

A glance at how InstalledAppDetails get packageName

1
2
3
4
5
6
7
8
9
final Bundle args = getArguments();
String packageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null;
if (packageName == null) {
    Intent intent = (args == null) ?
    getActivity().getIntent() : (Intent) args.getParcelable("intent");
    if (intent != null) {
        packageName = intent.getData().getSchemeSpecificPart();
    }
}

Others





快来解锁最新版 Typora,新用户券后仅需 84 元!
如何便宜的购买 office 365 ?
新版赤友 NTFS 助手来袭,正版超低价