GOOGLE ASSISTANT READ NEWS COMMAND

Post your questions and help other users.

Moderator: Martin

Post Reply
davinik
Posts: 11
Joined: 23 Oct 2018 12:36

GOOGLE ASSISTANT READ NEWS COMMAND

Post by davinik » 16 Apr 2019 08:28

I'd like to send "read news" command to google assistant in the morning.. can someone help me? :P

User avatar
Desmanto
Posts: 1873
Joined: 21 Jul 2017 17:50

Re: GOOGLE ASSISTANT READ NEWS COMMAND

Post by Desmanto » 20 Apr 2019 13:44

You will need to enable accessibility services for Automagic, and you can only use this with screen on, as we are going to use Control UI. So if you want to trigger this flow from screen off, you have to add another set of action to turn on and unlock the screen first (which will require device admin or even root in some devices).

Use trigger Time, time in the morning
Add action : Launch App, to launch google assistant
Package name : com.google.android.googlequicksearchbox
Class Name : com.google.android.apps.gsa.staticplugins.opa.hq.OpaHqActivity

Add another action : Control UI, to send the command. You can look at control UI tutorial here : viewtopic.php?f=6&t=7320
But I just paste the script below that you can use directly

Code: Select all

sleep(1000); //increase this if your Google Assistant takes time to load up.
clickById("com.google.android.googlequicksearchbox:id/opa_hq_content_footer_icon_keyboard");
sleep(500);
setText2ById("com.google.android.googlequicksearchbox:id/input_text", "read news");
sleep(100);
clickById("com.google.android.googlequicksearchbox:id/send_button");
The text that sent is "read news", which you can change to something else. If you need to exit from the assistant after each command, you can add additional script

Code: Select all

sleep(2000);
back();
sleep(200);
back();
Which will press back twice to exit from the app and back to the previous app.
or

Code: Select all

sleep(2000);
home();
Which will press home and immediately go back to home screen.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190714, Pie 9.0, Rooted.

Post Reply