Android“检测到屏幕覆盖"显示通知时用户尝试授予权限的消息 [英] Android "Screen Overlay Detected" message if user is trying to grant a permission when a notification is showing

查看:29
本文介绍了Android“检测到屏幕覆盖"显示通知时用户尝试授予权限的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Nexus 6 上安装了 Android Marshmallow.我正在尝试解决以下问题:

I have Android Marshmallow on a Nexus 6. I am trying to fix the following problem:

如果用户在显示通知时尝试授予权限,则会显示检测到屏幕覆盖"消息,并且请求权限"对话框消失 - 当然应用程序不会获得请求的权限.(检查截图)

If a user is trying to grant permission while a notification is showing, a "Screen overlay detected" message gets displayed and the Request Permission dialog disappears - of course the app does not get the requested permission. (Check screenshot)

我试图通过在清单中添加DRAW OVER OTHER APPS"权限 - android.permission.SYSTEM_ALERT_WINDOW 来解决这个问题,但没有成功.

I tried to fix the problem by adding "DRAW OVER OTHER APPS" permission - android.permission.SYSTEM_ALERT_WINDOW to the manifest but with no luck.

PS:我确定问题是由通知引起的.我没有安装任何覆盖其他应用程序的应用程序,我什至在设置中关闭了所有具有绘制其他应用程序"权限的应用程序.没有帮助..

PS: I am sure the problem is caused by the notification. I do not have any app installed that overlays over other apps, I even turned off all apps with "Draw over other apps" permission in the settings. Did not help..

有人知道该问题的解决方案吗?

Anyone knows a solution to that problem?

推荐答案

在我遇到的情况下,问题是我自己造成的.这是在我请求许可的同时使用 Toast 向用户显示信息的结果.这两个操作共同导致此类错误.

In the circumstance that I ran across, I was causing the problem myself. It was the result of using a Toast to display information to the user at the same time that I was asking for permission. Both of these actions together cause this type of error.

其他答案可能会解决其他人的问题.但我想指出的是,您应该小心避免导致自己的叠加错误.小心在视图中叠加某些内容,同时请求许可.

The other answers might resolve someone else's issue. But I wanted to note that you should be cautious of causing your own overlays errors. Be careful of overlaying something in the view while simultaneously asking for permission.

这篇关于Android“检测到屏幕覆盖"显示通知时用户尝试授予权限的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆