我正在构建一个安卓应用程序,在那里我想读取WindowManager(系统警报)警报文本,是从一些其他应用程序触发。
假设有一些应用程序,如真正的呼叫者,在每个呼叫结束后,该应用程序显示该特定电话号码的一些信息,在安卓的WindowManager(系统提醒),我想读取所有这些信息与该电话号码,这是显示在WindowManger(系统提醒)使用我的应用程序。
有没有办法读取或查看由其他应用程序触发的WindowManger(系统警报)报警对话框的子级。
发布于 2017-05-17 16:13:10
我认为一种方法是编写一个可访问性服务(https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html)并与一些可访问性事件挂钩。也许是TYPE_WINDOW_STATE_CHANGED?
发布于 2017-05-17 21:25:19
您可以尝试在辅助功能服务中设置AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS,并侦听以下事件
case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
AccessibilityNodeInfo nodes = getRootInActiveWindow();
String nodeText = nodes.getText();
String nodeContentText nodes.getContentDescription();
// Also you could cycle through the children repeating the same
// As an example only taking the first child, you could
// loop through or use recursion
AccessibilityNodeInfo firstNode = nodes.getChild(0)
String nodeTextFirstChild = firstNode.getText();
String nodeContentTextFirstChild = firstNode.getContentDescription();
}https://stackoverflow.com/questions/44017869
复制相似问题