[英]Read other application WindowManager(System Alert) Alert in android?
I am building an android application where I want to read WindowManager(System Alert) Alert Text that is trigger from some other application. 我正在构建一个Android应用程序,我想在其中读取其他应用程序触发的WindowManager(System Alert)Alert Text。
Suppose there is some application like true caller and after the end of each call this application display some information of that particular phone number in WindowManager(System Alert) of android and I want to read all this information related to that phone number which is displayed in WindowManger(System Alert) using my application. 假设有某个应用程序,例如真正的呼叫者,并且在每次通话结束后,此应用程序在android的WindowManager(System Alert)中显示该特定电话号码的某些信息,而我想读取与该电话号码相关的所有信息使用我的应用程序的WindowManger(System Alert)。
Is there any way to read or to get view child of WindowManger(System Alert) Alert dialog trigger by other application. 是否有任何方法可以读取或获取其他应用程序触发的WindowManger(System Alert)Alert对话框的子视图。
Think one way would be to write an accessibility service ( https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html ) and hook to some accessibility events. 想办法之一是编写一个可访问性服务( https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html )并挂钩一些可访问性事件。 Maybe TYPE_WINDOW_STATE_CHANGED?
也许是TYPE_WINDOW_STATE_CHANGED?
You can try setting AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
in the accessibility service and listen for events like 您可以尝试在可访问性服务中设置
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();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.