[英]How to open 'App Permissions' page in Settings programmatically in Android?
I know there is many question about it already.我知道已经有很多问题了。
But today I found this:但是今天我发现了这个:
My phone is Gallaxy Note 4 and Samsung Gallery app works just as I want 'open App permissions page from Activity!'我的手机是 Gallaxy Note 4 和三星画廊应用程序就像我想要的那样“从活动打开应用程序权限页面!” not setting-detail page.不是设置详细信息页面。
Anyone knows how to do that?有谁知道怎么做?
Here is a method to open Settings > Permissions for your application:以下是为您的应用程序打开“设置”>“权限”的方法:
public static void openPermissionSettings(Activity activity) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + activity.getPackageName()));
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
}
You should consider using this when your permission is denied and shouldShowRequestPermissionRationale(Activity activity, String permission)
returns true.当您的权限被拒绝并且shouldShowRequestPermissionRationale(Activity activity, String permission)
返回 true 时,您应该考虑使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.