简体   繁体   English

将权限设置为“不再询问”后,Android 6棉花糖黑屏

[英]Android 6 Marshmallow Black Screen after set Permission to Never Ask Again

I have got this really weird behaviour. 我有这种非常奇怪的行为。

After adding the permissions at runtime for my app, I was checking and testing all cases. 在运行时为我的应用添加权限之后,我正在检查和测试所有情况。

I have the request code in my MainActivity. 我的MainActivity中有请求代码。

So, after I set Never Ask Again and deny the giving permission for ACCESS_FINE_LOCATION, if I press the menu button and then restart the app (the app will call onResume of MainActivity I guess), then the screen is black except a rectangle part in the middle of the screen which varies in size. 因此,在设置“不再询问”并拒绝授予ACCESS_FINE_LOCATION的许可后,如果我按菜单按钮然后重新启动应用程序(我猜该应用程序将调用MainActivity的onResume),则屏幕为黑色,除了屏幕中间大小不一。 (Is not the AlertDialog size) (不是AlertDialog的大小)

Here some screenshots: 这里有一些截图:

Normal screen 正常画面

正常

After press menu and then open again can be that it opens with the normal state or with these states: 在按下菜单然后再次打开后,可以以正常状态或以下状态打开它:

黑屏,可见任意大小的正方形

Or 要么

小广场

This is quite weird, anybody had this before? 这很奇怪,有人以前有过吗?

Thanks for your answers! 感谢您的回答!

Without seeing the code, it's hard to give a very accurate answer. 如果不看代码,很难给出一个非常准确的答案。

When requesting permissions, if the user selected 'never ask again', the request permissions response will be denied. 请求权限时,如果用户选择“不再询问”,则请求权限响应将被拒绝。 I'm GUESSING (due to lack of code) that your app relies on the granted permission to continue loading the UI and executing more code, which it won't do if permission is denied. 我正在猜测(由于缺少代码),您的应用程序依赖于授予的权限才能继续加载UI和执行更多代码,如果权限被拒绝,则不会这样做。 You need to handle all possible responses when requesting runtime permissions. 请求运行时权限时,您需要处理所有可能的响应。

if permission is granted: good to go if permission is denied: check if you should show the permission rationale. 如果已授予许可:如果拒绝许可,则可以执行:检查是否应显示许可理由。 This means you display a message to the user explaining why you need the permission. 这意味着您向用户显示一条消息,解释为什么需要许可。

if shouldShowRationale is true: it means 'never ask again' was NOT checked. 如果shouldShowRationale为true:表示未选中“不再询问”。 Display the message, then ask for permission again. 显示消息,然后再次请求权限。

if should show Rationale is false: it means 'never ask again' was checked and you should probably direct the user to the app settings to turn the permission on if it's required. 如果应该显示Rationale为假:表示选中了“不再询问”,您可能应该将用户引导至应用设置以打开权限(如果需要)。

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

相关问题 Android Marshmallow - 如何知道“永不再问”再次检查 - Android Marshmallow - how to know “Never ask again” is checked before Android运行时权限中永远不会显示“不再询问”复选框 - “Never ask again” checkbox is never shown in Android runtime permission Android 6权限对话框缺少复选框不再询问 - android 6 permission dialog missing checkbox for never ask again ReactNative:权限总是返回“不再询问” - ReactNative : permission always return 'never ask again' 权限总是返回 never_ask_again - Permission always returns never_ask_again 仅针对Android Marshmallow请求运行时权限? - Ask for runtime permission only for Android Marshmallow? 如何在运行 UI 测试用例之前设置“不再询问”权限 - How to set "Never ask again" for permission before running UI test case 如何忘记 Android M 运行时权限对话框中的“不再询问”选项 - How to forget the "Never ask again" choice in Android M runtime permission dialog react-native RECEIVE_SMS android权限始终导致'never_ask_again' - react-native RECEIVE_SMS android permission always results 'never_ask_again' Android M:即使用户选择Never Ask Again,如何打开权限对话框? - Android M : How to open Permission Dialog even if user selects Never Ask Again ?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM