简体   繁体   English

如何在Android中以编程方式导航Gmail应用信息

[英]How to navigate gmail app info programmatically in android

How to navigate to Google map app info settings screen in android programmatically 如何在Android中以编程方式导航到Google Map App信息设置屏幕

please see this above link. 请参见上面的链接。 This is my exact requirement, how to solve this problem 这是我的确切要求,如何解决这个问题

in 2.2 and below, there is no public APIs you can access. But you can still start the InstalledAppDetails activity just as the ManageApplications does.

 // utility method used to start sub activity
 private void startApplicationDetailsActivity() {
     // Create intent to start new activity
     Intent intent = new Intent(Intent.ACTION_VIEW);
     intent.setClass(this, InstalledAppDetails.class);
     intent.putExtra(APP_PKG_NAME, mCurrentPkgName);
     // start new activity to display extended information
     startActivityForResult(intent, INSTALLED_APP_DETAILS);
 }
Conclusion: you can start the "application info" screen like this i wrote:

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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM