开发者

How to enable Android tethering via shell command(s)?

开发者 https://www.devze.com 2023-01-25 12:51 出处:网络
Is there a way to enable the USB Tethering option in Android 2.2 FRG22D using a shell command? My goal is turn a Motorola Droid running Android 2.2 into a micro server. This device cannot connect to

Is there a way to enable the USB Tethering option in Android 2.2 FRG22D using a shell command?

My goal is turn a Motorola Droid running Android 2.2 into a micro server. This device cannot connect to 3G and Wifi is not option. The device will always be connected via USB to a computer with a network connection. I have gotten the reverse tethering working, but I still have to manually check the USB Tethering check box (Settings->Wireless & Networks -> Tethering -> USB Tethering) every time the USB connection resets (such as when the computer is rebooted, the cable is unplugged, etc). My goal is write a script that can be ran on the host computer to bring the USB Tethering up without having to touch the Droid (I have root access开发者_StackOverflow社区 and the device will always be connected via USB so I can issue shell commands using ADB).

I have been searching for a shell command to do this but nothing has turned up. Another possible solution is that I could write a small app (either using the NDK or SDK) and call that from the script, but again I cannot find any information on how to change system settings (at least network level settings) via code.

Any suggestions?


in the source code of Settings app, mWifiManager.setWifiApEnabled(null, enable) is used, but this functionality seems to be missing in the SDK (checked 2.2 and 2.3).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号