英文:
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 DialogFragment
s. So I doubt you can recognize "popups" this way in a reliable way. Look for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
for more info
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论