有没有一种方法可以检测到 Android 中弹出窗口的出现

huangapple go评论74阅读模式
英文:

Is there a way to detect when a popup window appears in Android

问题

我开始了一个项目,创建了一个连接到安卓手机的Windows程序,用于向用户提供有关手机的信息,因此我想要显示手机上出现的所有弹出窗口。为了实现这一点,我需要使程序的应用版本以某种方式捕获这些弹出窗口,并向我提供发送弹出窗口的应用名称以及弹出窗口的内容。这是否可行?

英文:

I started a project of a windows program that connects to an android phone and gives the user information
about it, so I want to display all of the popups that appere on the phone. to do this I need the app version of the program to catch them somehow and give me the name of the app that sent the popup and the popup's contant. is it possible?

答案1

得分: 0

这可能会成为一个安全问题,如果任何应用都能够这样做... 你可以尝试使用AccessibilityService,并获得一些权限来读取屏幕/运行活动,并检查每个Activity的样式是否为“popup”,但请注意,其中一些只是DialogFragment。所以我怀疑你可以以可靠的方式通过这种方式识别“弹出窗口”。查阅AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED以获取更多信息。

英文:

it would be kind of security issue if any app could do that... you can try with AccessibilityService with some permissions for reading screen/running Activities and checking style of every Activity is this "popup", but note that some of them are just DialogFragments. So I doubt you can recognize "popups" this way in a reliable way. Look for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED for more info

huangapple
  • 本文由 发表于 2020年9月7日 15:35:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/63773179.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定