本文出自 “whithin's” 博客,请务必保留此出处http://whithin.blog.51cto.com/690417/1076101
设置 USB tethering
publicvoid setUSBTethering(boolean enabled){
ConnectivityManager cm =
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm.setUsbTethering(enabled) != ConnectivityManager.TETHER_ERROR_NO_ERROR ){
System. out.println("usb tethering set failed !" );
}
}
publicvoid enableUSBDebugging()
int adbEnabled=0;
try {
adbEnabled = Settings.Secure. getInt(getContentResolver(), Settings.Secure.ADB_ENABLED );
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
if(adbEnabled != 1){
Settings.Secure. putInt(getContentResolver(),Settings.Secure. ADB_ENABLED, 1);
}
本文出自 “whithin's” 博客,请务必保留此出处http://whithin.blog.51cto.com/690417/1076101
转载于:https://blog.51cto.com/yuzuolin/1330434