3

I need to set up an app-killing service for unrooted Android 9 devices using Automate. The service has to launch automatically at device start and keep sending kill commands to selected system (!) services at regular intervals unless said services are in focus/in the foreground.

Unfortunately, setting up and running Automate seems unnecessarily cumbersome. I have used adb extensively, so no problem there. However, step 5 in the setup manual says

  1. On the PC, execute the shell command adb tcpip 5555. This step has to be repeated after every device reboot.

Also:

Once paired/authorized the service will start automatically when it’s first used, e.g. by a block using it, then run in the background until the system kills it, the device is rebooted, or the app is uninstalled or updated.

Having to hook up a mobile device to a PC after each and every reboot (e.g. due to empty battery) is completely impractical and contradicts the use of Android itself. Is there a way to set up Automate either 100% locally from within Android, or at least only once from a PC at the very beginning and then have the app run automatically even after a device reboot?

I have already set up a simple Automate flow as a minimal example and granted all necessary privileges, such as access to the SD card, executing shell commands, and access to Samsung accessibility service. Also, USB debugging is enabled in the developer options. But when running the flow, I get the following errors in the log output:

Flow beginning
Delay
App in foreground?
App kill
Failed to start privileged service
java.util.concurrent.CancellationException: Please execute: sh /sdcard/Android/data/com.llamalab.automate/cache/start.sh
java.util.concurrent.TimeoutException: Service startup timeout
Stopped by failure
1

1 Answer 1

0

Automate does not require ADB nor a rooted device, but some features do, e.g. the App kill block to kill the processes of other running apps.

Setting up ADB is indeed a bit cumbersome since it's an app developer feature, it's not designed for easy use by app users or by the apps themselves.

Setting up Automate "100% locally", i.e. without needing a USB connected PC, can only be done on Android 11 or higher by using the system "Wireless debugging" feature. To do so simply choose the "Android Debug Bridge (ADB)" option as the "Privileged service start method" in Automate setting, then follow the on screen instructions to enable the "Wireless debugging" option and pair Automate with the device. The pairing process only have to be done once, but enabling "Wireless debugging" has to be done manually after every reboot, unless you automate the procedure.

The logged error message means Automate can't access/start its "privileged service", e.g. that the App kill block rely on, and tells you to execute the shell script to do so, this means you've selected the "Manually" option as "Privileged service start method". Try the "Android Debug Bridge (ADB)" option instead.

9
  • "Setting up ADB is indeed a bit cumbersome" => As I wrote, no problem here. I've been using adb a lot. With "cumbersome" I mean the requirement to hook up the device to a PC after every reboot. This is an impossible demand for mobile device usage.
    – srhslvmn
    Mar 9 at 18:30
  • "The logged error message means Automate can't access/start its "privileged service", e.g. that the App kill block rely on, and tells you to execute the shell script" => Can't Automate itself execute the shell script? There is explicitly an option to permit Automate to execute shell commands, which I've already enabled in the system app permission settings!
    – srhslvmn
    Mar 9 at 18:33
  • "Automate does not require ADB nor a rooted device, but some features do, e.g. the App kill block to kill the processes of other running apps." => This only seems to be the case for Android 14+, but not for Android 9+ which is what this question is dealing with.
    – srhslvmn
    Mar 9 at 23:03
  • @srhslvmn As said, a PC is not needed on Android 11+ when using the system "Wireless debugging" feature. Automate will execute the commands in shell script when using the "Android Debug Bridge" or "Superuser" option as "Privileged service start method". Regular apps could only kill background processes prior to Android 14, i.e. the App kill background block.
    – ballzak
    Mar 10 at 9:47
  • Sorry, but there seems to be a misunderstanding. "Android 9+" in the question means that a solution for Android 9 and higher is required (i.e. including version 9).
    – srhslvmn
    Mar 10 at 21:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .