enable usb tethering via command line failed

本文介绍了使用ADB命令在Android设备上实现USB网络共享的方法。包括启动设置界面、模拟点击操作及调用系统服务等手段,并提供了针对不同Android版本的具体命令。

https://stackoverflow.com/questions/20226924/is-it-possible-to-usb-tether-an-android-device-using-adb-through-the-terminal


http://android.stackexchange.com/questions/29954/can-i-change-some-android-settings-from-the-command-line

method 1
adb shell am start -n com.android.settings/.TetherSettings 



adb shell input tap <x> <y>


method 2
setprop sys.usb.config rndis,adb


method 3

Running the following command as root should enable USB tethering:

  • service call connectivity 32 i32 1 on Ice Cream Sandwich (4.0)
  • service call connectivity 33 i32 1 on Jelly Bean 4.1 and Jelly Bean 4.2
  • service call connectivity 34 i32 1 on Jelly Bean 4.3 and KitKat (4.4)
  • service call connectivity 30 i32 1 on Lollipop (5.0)

The first number you see in the commands is the setUsbTethering() method's number in IConnectivityManager.aidl (this depends on the Android version and doesn't exist on Gingerbread).

(Tip: to check this file for a particular Android version, select the appropriate branch.)

So what this command does is call setUsbTethering() and pass either 1 (enable USB tethering) or 0 (to disable it).

For more information, see this related question on Stack Overflow.



But, all of these method failed, because of "permission denied"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值