running flow task on boot

280 views
Skip to first unread message

nir hasan

unread,
Apr 21, 2022, 10:12:15 AM4/21/22
to Automate
hey there .

i have a task that i'd like to start when the phone boots how can i do that ?


note that i have multiple flow tasks , how can i select the one that i need to start after boot .

i did see in the settings "run on system startup" [resume running flows on system startup (boot)]  , however i dont have the option to select a certain flow (also i doubt it is the setting i need since it says resume) 

thanks <3

nir hasan

unread,
Apr 21, 2022, 10:54:41 AM4/21/22
to Automate
i must say that ,
1, run on system startup is enable .
2, no restriction on battery no battery saver on automate .

i have a xiaomi C9 , android version 10 Qp1A.190711.020 , miui golbal 12.0.16  (rooted)

nir hasan

unread,
Apr 21, 2022, 11:12:27 AM4/21/22
to Automate
@Henrik 

i noticed something really disturbing ,  

here is my flow .
3G.png




upon reboot "act as voice assistant with access to screen content"  (which idk why its even there)  goes inactive , EVEN THO assist app is selected to be automate ...

idk if this is the problem thats making the flow not to run on startup

and apparently to use airplane mode you need the voice assistant  (which is weird) 

Screenshot_2022-04-21-18-06-17-789_com.llamalab.automate.jpg



Screenshot_2022-04-21-18-05-57-574_com.android.settings.jpg

nir hasan

unread,
Apr 21, 2022, 11:17:56 AM4/21/22
to Automate
so i removed the Airplane mode , and yet the flow does not run automatically. 

Henrik "The Developer" Lindqvist

unread,
Apr 21, 2022, 12:48:42 PM4/21/22
to Automate
You need to connect the last block #3 back up to the first block #10 otherwise the flow will just run for one reboot.
If the a Xiaomi device then you likely also has to enable some custom setting to allow an app to run at boot.

nir hasan

unread,
Apr 21, 2022, 12:49:17 PM4/21/22
to Automate
even  THIS does not work on startup . 

Flow begin > broadcast receive "boot complete" > start app 
or 
Flow begin > start app  


idk wtf is going on to be honest


Henrik "The Developer" Lindqvist

unread,
Apr 21, 2022, 12:53:37 PM4/21/22
to Automate
If Android 10+ ensure the "appear on top of other apps" privilege is granted, and again, if Xiaomi look for any non-standard setting.

nir hasan

unread,
Apr 21, 2022, 12:55:43 PM4/21/22
to Automate
what do you mean for one reboot ? 

i dont want it to loop over and over when its on .

i want that when the phone boot it set some settings and start an app . one time  every boot .
reason being is when  rebooting the phone the settings of selecting a Band reset itself to default  , so each boot i'd like to fix the band automatically 

nir hasan

unread,
Apr 21, 2022, 12:56:31 PM4/21/22
to Automate
i did , all permissions are allowed , all settings are enable .

nir hasan

unread,
Apr 21, 2022, 1:01:24 PM4/21/22
to Automate

Screenshot_2022-04-21-19-57-21-747_com.miui.securitycenter.jpg
Screenshot_2022-04-21-19-57-09-987_com.google.android.permissioncontroller.jpg

Screenshot_2022-04-21-19-57-46-355_com.miui.powerkeeper.jpg
Screenshot_2022-04-21-19-58-21-638_com.miui.securitycenter.jpg


On Thursday, April 21, 2022 at 7:53:37 PM UTC+3 Henrik "The Developer" Lindqvist wrote:

Henrik "The Developer" Lindqvist

unread,
Apr 21, 2022, 1:19:11 PM4/21/22
to Automate
It need to loop to do so every reboot, i.e. await another BOOT_COMPLETED, otherwise it stops after the first.

nir hasan

unread,
Apr 21, 2022, 4:50:30 PM4/21/22
to Automate
so what you are saying ?

flow >  boot_complete >  boot_complete > app start ?

nir hasan

unread,
Apr 21, 2022, 4:56:51 PM4/21/22
to Automate
well i tried .

flow >  boot_complete >  boot_complete > app start 
does not work .


neither

Flow begin >  "boot complete" > start app 
or 
Flow begin > start app  

idk what to do

Henrik "The Developer" Lindqvist

unread,
Apr 22, 2022, 7:12:51 AM4/22/22
to Automate
  1. Flow beginning
  2. Broadcast receive
  3. App start
  4. (loop back to #2)

nir hasan

unread,
Apr 22, 2022, 11:48:43 AM4/22/22
to Automate
that doesnt work .

i know it doesnt work because the app never started .
i think automate never receives boot complete .

i also tried "wait a minute" broadcast , even then it would not start the app .

it seems that automate does not run on start .

nir hasan

unread,
Apr 22, 2022, 1:08:06 PM4/22/22
to Automate
i have adb access to the phone and root on the phone ,

do you know perhaps how do i run that certain flow via adb ?  (also how do i configure it to run on boot)

Henrik "The Developer" Lindqvist

unread,
Apr 22, 2022, 3:59:18 PM4/22/22
to Automate
What does the flow log say?

Henrik "The Developer" Lindqvist

unread,
Apr 22, 2022, 3:59:52 PM4/22/22
to Automate
Neither ADB nor root is required for such a simple task.

nir hasan

unread,
Apr 22, 2022, 6:49:32 PM4/22/22
to Automate
does not say anything actually .
like it never ran .

nir hasan

unread,
Apr 22, 2022, 6:50:39 PM4/22/22
to Automate
even though it is not required i would love to know how to do that . 
for knowledge and incase we wont be able to make this work .

Henrik "The Developer" Lindqvist

unread,
Apr 23, 2022, 7:49:28 AM4/23/22
to Automate
It must say something when you click the Start button.
Ensure you've not disabled logging in the menu.

nir hasan

unread,
Apr 23, 2022, 8:53:27 AM4/23/22
to Automate
yea i know that , when i manually click there is no problem something apear in the log
"flow beginning 
 broadcast receive"  .
and nothing else happen since its waiting for the broardcast (so i have the stop button enable to click on it)
if i remove the broadcast and lets say put a app it will say that the app start , no problem there .

but at boot nothing happen , i also tested it by created a new flow , without clicking on it ones , so its brand new .
and rebooting the phone , it does not create any log. (meaning nothing is running)

Henrik "The Developer" Lindqvist

unread,
Apr 23, 2022, 9:02:24 AM4/23/22
to Automate
So the flow starts properly, and await a reboot.
And what does it say after you've rebooted the device, while the flow is running?

nir hasan

unread,
Apr 23, 2022, 9:39:59 AM4/23/22
to Automate
i havent tried it , i havent tried to run it to do nothing and restart it while doing nothing.

thats actually ingenious .
now it works .

is there an option to unlock the phone automatically on boot ? 

no pad lock or passcode is required . (there is none)

Henrik "The Developer" Lindqvist

unread,
Apr 23, 2022, 12:05:40 PM4/23/22
to Automate
Try using the Screen lock set state block.

nir hasan

unread,
Apr 23, 2022, 1:35:05 PM4/23/22
to Automate
i did look at it , but idk what  how to actually unlock it 

Henrik "The Developer" Lindqvist

unread,
Apr 24, 2022, 7:07:08 AM4/24/22
to Automate
Insert an Screen lock set state block with the Disable option checked somewhere in the flow where you wish the device to unlock.

nir hasan

unread,
Apr 24, 2022, 8:06:08 AM4/24/22
to Automate
ya that does not work.

flow begin > is device unlocked (no) > disable screen lock secure 

im not sure i was clear tho , 

the phone as no passcode or patern , i just like for it swipe to "unlock" , i did try the interact gesture and try many values , nothing seems to work .


(also side note , can you explain me , what are the set of the adb command should look like to set the preference band .)

Henrik "The Developer" Lindqvist

unread,
Apr 25, 2022, 9:30:13 AM4/25/22
to Automate
Don't enable the Secure option as it requires a rooted device.
Generally this should work for swipe screen locks, but maybe not at reboot, since apps aren't started until you unlock it a first time.

nir hasan

unread,
Apr 30, 2022, 4:18:14 AM4/30/22
to Automate
Well in my case , even though the phone just booted , the app do start in the background , and in this case , this phone is rooted aswell :)

It wont unlock even after first unlock. (What im trying to say is , its not a boot issue)

Henrik "The Developer" Lindqvist

unread,
Apr 30, 2022, 7:07:10 AM4/30/22
to Automate
If you have an Xiaomi or Huawei device then ensure to enable any of their non-standard system setting option to prevent background app starts.

nir hasan

unread,
May 1, 2022, 5:10:36 PM5/1/22
to Automate
again , the app do start on background , thats not that .( i know its running on the background because the other tasks (flows) do run when the phone is in a lock state)

either way i found a different way .

in developer options in xiaomi  phones i just found , an option that is called  "skip screen lock" (go directly to home screen from wake) 
which in short is what i was looking for ^,^ , when unlocking it goes directly to the home screen  with out the need to swip to unlock the phone , its even working when the phones boots .
thanks alot !

could you please explain how the "set mobile network" block works ?
i'd like to do the same thing via adb , manually . 
i know its  something like /system/bin/settings put global preferred_network_mode 9,2 / /system/bin/settings put global preferred_network_mode1 9,2  but even changing those it wont reload the change the service .

thank you again !

Henrik "The Developer" Lindqvist

unread,
May 2, 2022, 8:20:33 AM5/2/22
to Automate
I doubt that simply changing a setting will suffice, and there's no ADB/shell command for it either.

nir hasan

unread,
May 7, 2022, 5:24:50 AM5/7/22
to automa...@googlegroups.com
Can you explain how the band preference works under the hood. 
Thanks .

(Btw in many phones you can open the test settings manually by calling *#*#4636#*#* , and from there going to phone information , and there settings the bands you don't need root for that )


--
You received this message because you are subscribed to a topic in the Google Groups "Automate" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/automate-user/ox-CoMs7JXs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to automate-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/f0186510-b9d4-4382-a5b9-d05756260a30n%40googlegroups.com.

Henrik "The Developer" Lindqvist

unread,
May 7, 2022, 11:03:39 AM5/7/22
to Automate
The block simply use the Android API, a single function call to change allowed networks, just like how the system Settings does it.
I don't know how that function call work "under the hood", i guess it forward that call to the telephony driver, which then configures the hardware.

nir hasan

unread,
May 11, 2022, 7:02:50 AM5/11/22
to Automate
ok , thank you very much .
perhaps there is a way to do it "manually" with out the need for root .

Henrik "The Developer" Lindqvist

unread,
May 11, 2022, 9:53:18 AM5/11/22
to Automate
The only way is using the Interact block to simulate the clicks to do so.
Reply all
Reply to author
Forward
0 new messages