转到我的应用程序的应用程序权限屏幕
Go to My app's App Permission screen
是否有进入 Android-M 中我应用程序的 "App Permissions" 屏幕的意图?
我正在让我的应用程序为 Android-M 和新的权限模型做好准备。我已按照 link
中提到的所有步骤进行操作
https://developer.android.com/training/permissions/requesting.html
一切都已设置好,如果用户选中了 "Never ask again" 按钮并拒绝了权限,那么在下次启动时,我想为用户提供一个选项,让其转到应用程序的 "App Permissions" 并自己更改许可,如果他改变主意的话。我想通过提供一个按钮将用户直接带到我的应用程序的 "App Permissions" 屏幕,让不懂技术的用户更容易一些。有办法吗? (这比给用户指令 Menu
→ Settings
→ Applications
→ Manage Applications
→ select 应用程序要好得多)
感谢您的帮助!
不,不打算直接进入权限屏幕。
但是,就像 Android 的早期版本一样,您可以使用以下代码将人们指向您的应用程序的详细信息设置页面:
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
这将允许他们在访问权限之前只需点击一个按钮(该屏幕上的“权限”按钮)。
请注意,根据 UX around asking for permissions, consider linking to the settings page only as a last resort and only in cases where the permission is necessary for your app to function at all - ideally, you should show a strong rationale when shouldShowRequestPermissionRationale() returns true
(即,他们拒绝了一次但没有命中 'never ask again'),因此第二次用户看到一个权限对话框,他们确切地知道您为什么需要该权限。这意味着用户点击 'never ask again' 应该被视为一个非常强烈的信号,表明该用户永远不会授予您该权限。
不幸的是,这是不可能的,但是,就像其他所有应用程序一样,我们可以打开应用程序的设置页面,以便用户可以从那里手动授予必要的权限。
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", packageName, null)
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
是否有进入 Android-M 中我应用程序的 "App Permissions" 屏幕的意图?
我正在让我的应用程序为 Android-M 和新的权限模型做好准备。我已按照 link
中提到的所有步骤进行操作https://developer.android.com/training/permissions/requesting.html
一切都已设置好,如果用户选中了 "Never ask again" 按钮并拒绝了权限,那么在下次启动时,我想为用户提供一个选项,让其转到应用程序的 "App Permissions" 并自己更改许可,如果他改变主意的话。我想通过提供一个按钮将用户直接带到我的应用程序的 "App Permissions" 屏幕,让不懂技术的用户更容易一些。有办法吗? (这比给用户指令 Menu
→ Settings
→ Applications
→ Manage Applications
→ select 应用程序要好得多)
感谢您的帮助!
不,不打算直接进入权限屏幕。
但是,就像 Android 的早期版本一样,您可以使用以下代码将人们指向您的应用程序的详细信息设置页面:
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
这将允许他们在访问权限之前只需点击一个按钮(该屏幕上的“权限”按钮)。
请注意,根据 UX around asking for permissions, consider linking to the settings page only as a last resort and only in cases where the permission is necessary for your app to function at all - ideally, you should show a strong rationale when shouldShowRequestPermissionRationale() returns true
(即,他们拒绝了一次但没有命中 'never ask again'),因此第二次用户看到一个权限对话框,他们确切地知道您为什么需要该权限。这意味着用户点击 'never ask again' 应该被视为一个非常强烈的信号,表明该用户永远不会授予您该权限。
不幸的是,这是不可能的,但是,就像其他所有应用程序一样,我们可以打开应用程序的设置页面,以便用户可以从那里手动授予必要的权限。
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", packageName, null)
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)