I'm running Marshmallow on a Nexus 5, and I tether it to my laptop via USB. Is there a way to configure things so that the tethering happens automatically when I plug things in? (It's 5-6 touches to turn on the tethering.)
The action Net → USB Tether of Tasker app as suggested by philx_x doesn't work in my CM13 for OnePlus One. The action is not supported so it appears disabled. The workaround is to use this action:
Code → Run Shell:
service call connectivity 30 i32 1
- tick Use Root
Use it with the profile: State → Power → Power → Source: USB
Note: your Android needs to be rooted.
Automate also worked in my ROM, albeit with root access. This is how the flow can look like:
(Click image to enlarge)
- The second block is named Power source plugged?
- The last block is named USB tethering set state.
Configure those blocks per your needs. Make sure you install the permission it asks for before you start the flow.
Here are two explanatory screenshots from the Automate app:
You might have to modify the
UI Element Class or
UI Element Text to make it work with your phone.