设置 USB tethering
- public void 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 !" );
- }
- }
- public void 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);
- }