My requirement: Reading the text from pop up, dialog etc for particular app.
I have implemented an accessibility service and I am receiving proper events and data as per my requirement. However while testing I realized that on some devices instead of using a AlertDialog or Dialog they have used an activity(themed as a dialog). Hence in my accessibility event I receive only the activity title, is there a way I could find the text displayed by this particular pop up activity?
I have searched pretty hard but could not get much help on the topic nor did the documentation be of any good in this concern. There is not much in the code of accessibility service but if you still need I will post it later.
Thanks
This is the code I use and it works for me:
Declare it in Android manifest
Create a xml file that describes the accessibility service called ussd_service
Use accessiblityNodeInfo to get information even in the case of when phone is returning it will fetch the ussd response also it will dismiss dialog when there is option to enter multiple choices.
First of all in case of [pohne] event class name is returned as ussdalertactivty so i used only "alert" for identification of alert dialog of ussd response.
Now i have made a function called fetchResponse which will return the response from pcn as string and will also dismiss the dialog so need to do performGlobalAction(GLOBAL_ACTION_BACK).
Hope this will solve the issue irrespective of the devices.
you should check whether there are any sub child for child nodes.