I currently do it manually each time after my phone is restarted. I connect using adb and running this
adb shell sh /sdcard/AFolder/ascript.sh "a-dummy-argument" &
Then I just disconnect the cable and script continue working.
How I can achieve the same thing on non rooted Android 7.0 and Android 9.0 devices(I have 2 and I would like to do this on both)? I would like to avoid rooting. From what I was reading it can not be done without rooting. My question is, would it be possible to install TWRP, backup stock ROM, modify stock ROM so that it would have an additional file
ascript.sh (or run it from sd card) which will be started at startup. Then flash this modified ROM, to avoid doing this manually. Is this possible?
Note: adb via tcp I believe is not an option as to make adb work via tcp on non rooted device after each reboot we need to connect the device to PC first to switch to tcpip, so we back to the task how to avoid after reboot connecting phone to PC.