20

I'm running Android Marshmallow on a Nexus 5. I tether it to my laptop via USB. Is there a way to configure things so that the USB tethering happens automatically when I plug things in? (It takes 5-6 touches to turn on the USB tethering.)

1
  • Just a side note - if you find an answer that works, make sure you remember what state tethering is (on/off) when you use it with any other computer ;)
    – Joe
    Nov 4 '15 at 13:58
16

Having tried multiple answers to this question and never getting it to work, I noticed on my Xiami phone running MUI 11 (Android 9) that turning on "Developer Options" now has an option for the default USB setting - one of which is USB tethering. This works flawlessly for me.

5
  • Confirmed on a Pixel 2 running Android 10.
    – chx
    Feb 27 '20 at 3:18
  • Works on an S10 with Android 10 as well.
    – Mark Szabo
    Jul 30 '20 at 13:25
  • Does not work on a Galaxy S7 with Android 8. The option is available but has no effect.
    – LTR
    Oct 31 '20 at 19:33
  • unfortunately, this option requires disabling "USB file transfer" which is very useful for developers - it would best to allow both USB tethering and file transfer but it is not possible to check two modes in Pocophone f1 dev tools
    – dkocich
    Dec 8 '20 at 18:43
  • @dkocich Developers can still enable USB Debugging and use adb push / adb pull, though. Might be not that convenient, but gets the job done. Jun 28 at 20:07
9

Developer options settings has a setting to set default USB configuration. Its name could vary depending upon your ROM, so try looking for any setting having the name "USB configuration" under Developer options. Click on that, and choose the option which has "USB tethering" or "RNDIS" written.

From than on, whenever you would plug the device with a PC using USB cable and unlock the device, if not unlocked already, USB tethering would automatically be enabled. I tested this on a OnePlus 6 running Android 10 and the settings change persisted across multiple plugging/unplugging and reboots.

Developer options settings are by-default hidden though. To enable the access to them, you would need to follow certain steps. Google's instruction per "Configure on-device developer options" are:

On Android 4.1 and lower, the Developer options screen is available by default. On Android 4.2 and higher, you must enable this screen. To enable developer options, tap the Build Number option 7 times. You can find this option in one of the following locations, depending on your Android version:

  • Android 9 (API level 28) and higher: Settings > About Phone > Build Number
  • Android 8.0.0 (API level 26) and Android 8.1.0 (API level 26): Settings > System > About Phone > Build Number
  • Android 7.1 (API level 25) and lower: Settings > About Phone > Build Number

Note: instructions for your ROM may differ if the aforesaid instructions from Google fail to work to enable Developer options. Your OEM or third-party websites are better alternatives to search for the solution in that case.

3
  • 1
    Thanks! This is THE way to do it. Jul 22 '20 at 9:51
  • 7 times on Build Number, of course, how could I miss this option?!
    – Ed'ka
    May 11 at 7:20
  • it needs to be unlocked first for the default option to work. good point.
    – tinker
    Jun 9 at 6:17
6

You can do this using the Interact block in Automate. Then it does not require root. Here is a flow to do just that. I first got the idea from a post by llamalab on androidforums.

Here are two explanatory screenshots from the Automate app:

Part of the flow The interact settings

You might have to modify the UI Element Class or UI Element Text to make it work with your phone.

1
  • Works for me without root. However, I still have to manually unlock the device.
    – lewurm
    Oct 10 '18 at 15:10
0

Try Tasker.

Enable USB Tethering when USB is plugged in into a PC:

  • Context: State –> USB Plugged
  • Action: Net –> USB Tether

Source

1
  • 1
    Does not seem to work for all devices - USB tether says "sorry, this action is unavailable for this device". Feb 12 at 9:58

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