Capture pop up message

Post your questions and help other users.

Moderator: Martin

Post Reply
vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Capture pop up message

Post by vamzicool » 12 Sep 2016 08:48

I would like to capture the text of the pop up message from the telecom operator when issued by any ussd. For example after dialling *123# , the telecom operator sends back the balance of that connection as a pop up message. How do I capture that message text ?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Capture pop up message

Post by Martin » 12 Sep 2016 19:12

You can usually capture it with trigger UI Event to detect the popup (Event: Window opened, package could be com.android.phone but probably depends on ROM). Variable source_class_name could be helpful to distinguish the result from other events. On a Nexus 5X the source_class_name is android.app.AlertDialog.
The text of the dialog is probably stored in variable text. You could also use action Control UI with script text = getTextInActiveWindow(); to extract the whole text in the dialog if it's not already stored in variable text. Script function matches can also be used to check if the text matches a certain regular expression and to extract some portion of the text.

Regards,
Martin

vamzicool
Posts: 67
Joined: 29 Dec 2014 17:47

Re: Capture pop up message

Post by vamzicool » 24 Sep 2016 17:52

Thanks a lot Martin. I only had to change source_class_name to get my result.

yeyedroid
Posts: 7
Joined: 24 Sep 2016 16:44

Re: Capture pop up message

Post by yeyedroid » 06 Oct 2016 17:24

used the suggestions to automatically check "use MTP" in the Alert dialog that appears when USB cable is inserted in the phone (Marshmallow).
In my case the Alert Dialog was generated by Settings apk and i discovered it using the app "Current Activity" (shows which app/activity is currently showing).

May I suggest you to add a similar function in order to make easier to discover the current showed activity? Automagic already uses the accessibility service so it should be just a matter of making it visible to the user (something like the useful "show overlay control" feature available in Control UI action).

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Capture pop up message

Post by Martin » 07 Oct 2016 19:11

For this purpose I'm often using a flow with trigger Activity Started: */* and either check the log or use Notification on Screen: {package_name}/{class_name}.
I agree that an easier way to get this information makes sense. I add it to the todo-list.

Regards,
Martin

yeyedroid
Posts: 7
Joined: 24 Sep 2016 16:44

Re: Capture pop up message

Post by yeyedroid » 10 Oct 2016 20:12

Thanks for your kindness and attention. Regards to you

Post Reply