Page 1 of 1

GOOGLE ASSISTANT READ NEWS COMMAND

Posted: 16 Apr 2019 08:28
by davinik
I'd like to send "read news" command to google assistant in the morning.. can someone help me? :P

Re: GOOGLE ASSISTANT READ NEWS COMMAND

Posted: 20 Apr 2019 13:44
by Desmanto
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.