如何导航到谷歌地图应用信息设置在屏幕的Android程序(How to navigate to Go

2019-10-19 23:52发布

How to open Google maps settings info screen like above image in android from my app.I tried the following code but it is not working.

     String packageName = "com.google.android.maps";
          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);

   }
    startActivity(intent);

        }

If I am using my app package name it is navigating to settings info screen but if i am using google maps packgae name it is not navigating.Please help me on this. Thanks in advance.

文章来源: How to navigate to Google map app info settings screen in android programmatically