Wi-Fi Hotspot set state

508 views
Skip to first unread message

Mark Hands

unread,
Jun 12, 2025, 5:07:57 PMJun 12
to Automate for Android
Hi there,

I understand from the warnings when going to this block, and from the online documentation that this isn't guaranteed to work but I've had mixed results with it that I can't explain.

This block was working almost perfectly on my Pixel Fold 9 Pro Fold, not using any workarounds such as privileged service or legacy apps. I did have a flow stop on an error realted to the Wi-Fi hotspot set state block, unfortunately I can't remember the error as I cleared the log but I assume at the time it could be related to trying to set the hotspot to on, when it was already on and vise versa. So I added a state check beforehand and I believe it started working again.

However, it has started to error out again with "java.lang.IllegalStateException: Unknown error", which seems to be after my phone updated to Android 16 yesterday.

I've tried the privileged workaround (using wireless ADB) and legacy extension workaround but no luck. 

I guess nothing can be done considering all the warnings and documentation? Perhaps this is just a heads up to those on Pixel phones that this might stop working after Android 16.

Is there a privileged shell command for WiFi hotspot like there is for the WiFi state?

Henrik "The Developer" Lindqvist

unread,
Jun 13, 2025, 9:04:11 AMJun 13
to Automate for Android
As the documentation say, "The Wi-Fi adapter may have to be disabled, using the Wi-Fi set state block, before it’s possible to enable hotspot."

So even when using the "Privileged service" workaround the same error persist?

Google break lots of feature with every new Android version, so it's to be expected, especially for those that aren't official.
I got another report of an issue with enabling hotspot on Android 16, it didn't fail but had DHCP problems, so Google seems to have made some internal changes.
I'll try to fix, but that will difficult without testing on a real device, so this will have to wait until my Pixel device gets the Android 16 update.
For what i know, there's no ADB shell command to enable Wi-Fi tethering.

Mark Hands

unread,
Jun 14, 2025, 7:19:55 AMJun 14
to Automate for Android
So here's the log with Privileged service running via ADB wireless, and Privileged service set as Wi-Fi hotspot workaround. This doesn't have disabling of the Wi-Fi adapter disabled before, but I do have a question about that based on testing that further below.

06-14 12:03:32.696 I 188@1: Flow beginning
06-14 12:03:32.710 I 188@2: Wi-Fi hotspot set state
06-14 12:03:34.775 F 188@2: java.lang.IllegalStateException: Unknown error
06-14 12:03:34.779 I 188@2: Stopped by failure

Next I'll test the same as above, but I'll disable the Wi-Fi adapter beforehand using privileged command.

Here, block 10 is running "svc wifi disable" - which does turn off the WiFi adapter, but hotspot set state doesn't work still
06-14 12:14:25.837 I 190@1: Flow beginning
06-14 12:14:25.838 I 190@10: Shell command privileged
06-14 12:14:25.994 I 190@2: Wi-Fi hotspot set state
06-14 12:14:26.001 F 190@2: java.lang.IllegalStateException: Unknown error
06-14 12:14:26.002 I 190@2: Stopped by failure

Quick Q: would turning off the Wi-Fi adapter impact the privileged service if that is granted via the ADB wireless method?

Henrik "The Developer" Lindqvist

unread,
Jun 14, 2025, 10:11:04 AMJun 14
to Automate for Android
Yes, turning off Wi-Fi will probably kill the privileged service if started using "wireless debugging".
Try using the "Restart ADB in TCP/IP mode" for the service is started.
Message has been deleted

Christian Leeb

unread,
Jul 4, 2025, 6:11:41 AMJul 4
to Automate for Android
Hallo Henrik,
do you have allready a solution for the new functionality of hotspot in Android 16?

Henrik "The Developer" Lindqvist

unread,
Jul 4, 2025, 9:25:27 AMJul 4
to Automate for Android
I've hopefully fixed the "Unknown error" issue for the next release, probably for Alpha release next week.

Antonio DamGon

unread,
Sep 17, 2025, 1:26:54 PM (7 days ago) Sep 17
to Automate for Android
Hello, I still have the same problem on my Pixel 9 and Android 16.

Has anyone managed to get hotspot working? Could you please tell us how?

I have installed the last beta.

Thank you.



Henrik "The Developer" Lindqvist

unread,
Sep 17, 2025, 1:43:17 PM (7 days ago) Sep 17
to Automate for Android
Ensure the "Wi-Fi hotspot workaround" option is set to "Privilege service", and to setup an "Privileged service start method" as well.
If it then still doesn't work then the issue seems to vary with device as it works on my Pixel, maybe carriers have some way to disable it.

Christian Leeb

unread,
Sep 18, 2025, 5:55:04 AM (6 days ago) Sep 18
to Automate for Android
This trick only works for me when I'm logged into a Wi-Fi network. I don't have Wi-Fi in my car (the hotspot is supposed to provide that). I'm currently using "WiFi Auto Hotspot".

Andrew Alperovitz

unread,
Sep 18, 2025, 7:58:48 AM (6 days ago) Sep 18
to automa...@googlegroups.com
Yeah this app is giving me problems ever since we can't install legacy software on the new phones, they need to update that legacy app part of the system so that everything works right? You know what I mean everybody. God bless. Yeah I have a premium subscription but I can't really use it obviously.

--
You received this message because you are subscribed to the Google Groups "Automate for Android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automate-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/automate-user/43fbddf3-1242-468d-9bcb-c598779060b8n%40googlegroups.com.
Message has been deleted

Henrik "The Developer" Lindqvist

unread,
Sep 18, 2025, 9:01:09 AM (6 days ago) Sep 18
to Automate for Android
There' should be no problem installing the Legacy extension app, Google has just made it more cumbersome, please read the install instructions..

Henrik "The Developer" Lindqvist

unread,
Sep 18, 2025, 9:02:42 AM (6 days ago) Sep 18
to Automate for Android
You should only need to be connected to a Wi-Fi once after each reboot, to start the "privileged service", not every time a block using it is executed.

Antonio DamGon

unread,
Sep 18, 2025, 1:06:35 PM (6 days ago) Sep 18
to Automate for Android
Thanks Henrik, It automatically activates when Bluetooth is detected, but it doesn't deactivate when I leave the car, but that's fine.

C. O.

unread,
Sep 18, 2025, 2:23:40 PM (6 days ago) Sep 18
to Automate for Android
Hi Hernik,
After activating the wireless debugging as privileged starting method and detecting the bluetooth connection the access point state is set to enabled. --> Starting access point works.

A few seconds later: 
--> The device has no wireless connection anymore and gives the error message " Failed to start privileged service"
fd9012fe-8865-41f7-8020-81c52b8dc140.jpg
09-18 20:09:31.958 I 633@1: Flow beginning 09-18 20:09:31.960 I 633@3: Bluetooth device connected? 09-18 20:09:58.194 I 633@7: Wi-Fi hotspot set state 09-18 20:09:59.487 I 633@3: Bluetooth device connected? 09-18 20:10:13.162 I 633@4: Wi-Fi hotspot enabled? 09-18 20:10:13.163 I 633@10: Wi-Fi hotspot set state 09-18 20:10:24.657 W 633@10: Failed to start privileged service 09-18 20:10:24.659 W 633@10: java.util.concurrent.CancellationException: Awaiting Wi-Fi connectivity 09-18 20:10:38.931 W 633@10: Failed to start privileged service 09-18 20:10:38.933 W 633@10: java.util.concurrent.CancellationException: Awaiting Wi-Fi connectivity
I have installed the latest beta on my Pixel 7a.

BR Clemens

Antonio DamGon

unread,
Sep 19, 2025, 7:05:30 AM (5 days ago) Sep 19
to Automate for Android
I couldn't find the option "Privileged service start method", but I activated on settings "Run on system setup". I set to Privileged service --> on Workarounds section Bluetooth, Wi-Fi and hotspot.

Now, I got the next errors:

09-18 09:28:25.960 I 12@1: Flow beginning
09-18 09:28:25.967 I 12@2: Bluetooth device connected?
09-18 09:28:33.292 I 12@4: Wi-Fi hotspot set state
09-18 09:28:43.571 W 12@4: Failed to start privileged service
09-18 09:28:43.572 W 12@4: java.util.concurrent.CancellationException: Searching ADB services
09-18 09:28:48.652 F 12@4: java.util.concurrent.TimeoutException: Service startup timeout
09-18 09:28:48.665 I 12@4: Stopped by failure

Henrik "The Developer" Lindqvist

unread,
Sep 19, 2025, 7:39:09 AM (5 days ago) Sep 19
to Automate for Android
A the error say "Awaiting Wi-Fi connectivity".
If the "privileged service" isn't running when a block using is execute then a Wi-Fi network connection is required, for Automate to connect to the ADB on the device.
To force a connection immediately create and a simple flow like:
  1. Flow beginning
  2. Shell command privileged: Command line=ls

Henrik "The Developer" Lindqvist

unread,
Sep 19, 2025, 7:41:42 AM (5 days ago) Sep 19
to Automate for Android
You must have found it, since you've change it from disabled to using the "Android Debug Bridge" option.
The "Searching ADB services" message usually means that the "Wireless debugging" option has been disabled somehow.

C. O.

unread,
Sep 19, 2025, 9:53:56 AM (5 days ago) Sep 19
to Automate for Android
But the Wifi connection won't be available when I get in the car - I only use to for the ADB Debugging at home.
Is there a way to use Wireless Debugging as a privileged starting method when I am at home and have it still working for turning  on/off the hotspot state (on change of the bluetooth connection to the car) when I am at my car, where I have no Wifi?

мJ Zкxy

unread,
Sep 20, 2025, 5:40:28 PM (4 days ago) Sep 20
to Automate for Android
Maybe you can use cheap second phone for that with basic hotspot and generic Android model.

C. O.

unread,
Sep 20, 2025, 5:44:45 PM (4 days ago) Sep 20
to Automate for Android
I don't want to offend you, but that's a preposterous suggestion.
I want to automate the hotspot setting on my phone when I get in my car and not to have a second phone in use.
best regards

мJ Zкxy

unread,
Sep 21, 2025, 4:56:40 AM (3 days ago) Sep 21
to Automate for Android
Sorry I couldn't give you better suggestion I think connection to wifi is restriction by developer.

Henrik "The Developer" Lindqvist

unread,
Sep 21, 2025, 3:04:29 PM (3 days ago) Sep 21
to Automate for Android
Wi-Fi connectivity may only be necessary when starting the service, so start it while connected, e.g. using a flow like:
  1. Flow beginning
  2. Shell command privileged: Command line=ls
For other ways to make the "privileged service" more reliable, please read: https://llamalab.com/automate/doc/adb.html#privileged_service

C. O.

unread,
Sep 21, 2025, 5:31:02 PM (3 days ago) Sep 21
to Automate for Android
Unfortunatly that doesn't solve the issue.
I added the "Shell command privileged" Command line=ls is executed as the 2nd step in the flow.
If the WiFi connection is not present no further privileged services can be "started" executed again when the flow loops.
  • 09-21 23:22:39.139 I 719@1: Flow beginning
  • 09-21 23:22:39.140 I 719@14: Shell command privileged
  • 09-21 23:22:39.186 I 719@3: Bluetooth device connected?
  • --> Here I manually disable the WiFi - the connection also wouldn't be present at the car
  • --> I turn on the bluetooth device
  • 09-21 23:23:09.872 I 719@4: Wi-Fi hotspot enabled?
  • 09-21 23:23:09.878 I 719@10: Wi-Fi hotspot set state
  • 09-21 23:23:20.159 W 719@10: Failed to start privileged service
  • 09-21 23:23:20.162 W 719@10: java.util.concurrent.CancellationException: Awaiting Wi-Fi connectivity
  • 09-21 23:23:25.238 F 719@10: java.util.concurrent.TimeoutException: Service startup timeout
  • 09-21 23:23:25.249 I 719@10: Stopped by failure
Reply all
Reply to author
Forward
0 new messages