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

查看:132
本文介绍了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天全站免登陆