2017-05-17 63 views
0

我正在構建一個android應用程序,我想從其他應用程序中觸發WindowManager(系統警報)警報文本。在android中讀取其他應用程序WindowManager(系統警報)警報?

假設有一些應用程序像真正的調用者,並且在每次調用結束後,此應用程序在Android的WindowManager(系統警報)中顯示該特定電話號碼的一些信息,並且我想讀取與該電話號碼有關的所有信息它使用我的應用程序顯示在WindowManger(系統警報)中。

是否有任何方式讀取或獲取WindowManger(系統警報)警報對話框觸發其他應用程序的視圖子。

回答

0

您可以嘗試在輔助服務設置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(); 
    }