Do you have any idea how can we configure and turn on the wi-fi hotspot using the command line (ADB console)?

  • Welcome to Android Enthusiasts! Please don't forget to accept the answer if it solved your issue :) – Izzy Apr 27 '17 at 12:22

You could try this:

  adb shell am start -n com.android.settings/.TetherSettings
  adb shell input keyevent 20
  adb shell input keyevent 66

The first command opens the Settings page for Tethering and Hotspot while the latter simulate key presses: Down and Enter respectively.

Note: For different Android versions you may have to adjust the simulation of key presses depending on where the hotspot setting is located under settings.

Special Credits : Firelord and Kristopher

Firelord originally posted this as a comment, so I put this as an answer as comments are easily deleted or difficult to find

  • For android 5.0+ if this is not working then add another one more keyevent 20. Credits: Kristopher – xavier_fakerat Apr 26 '17 at 10:53
  • 1
    This is working fine. I am able to trigger the hotspot. Thanks – Ashish Apr 27 '17 at 11:31
  • @xavier_fakerat where does the additional keyevent 20 go? Should it be 20 20 66 or 20 66 20? – Andrew Dec 20 '17 at 16:58
  • 1
    @xavier_fakerat Thank you! My phone actually has cyanogenmod on it, and enabling the hotspot is the first option in the settings, so all I needed to do was enter adb shell am start -n com.android.settings/.TetherSettings then adb shell input keyevent 66. – Andrew Dec 21 '17 at 14:27
  • 1
    @Arctiic This is pretty normal. It is not an error message, it is a warning sort of, the system is trying to tell you that you already have the same instance of the activity thus the system tells you that it is not going to kill and restart it, but bring the activity of your already running task into the foreground. Depending on the actual input events you should get the hotspot up with no issues ;) – xavier_fakerat Jul 28 '19 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.