How to set the Usb connection mode?

Alexander Stolz picture Alexander Stolz · Jan 18, 2011 · Viewed 57k times · Source

I'm writing an application which is supposed to dump data on the SD card and then another application on a pc which should read the data when the device is connected to the pc (in disc drive mode). On my HTC Legend there is a dialog to choose between: Charge only, HTC Sync, Disk drive..

Is there a possibility to set the mode with which the device is connecting to the pc or at least an intent to ask the user to switch the mode?

Answer

mhsmith picture mhsmith · Mar 6, 2011

I haven't found a way of setting the mode programmatically, but I believe you can bring up the settings menu programmatically by invoking the same activity that the system invokes from the notification area. Unfortunately this appears to be manufacturer-specific: on my phone it is com.htc.android.psclient.SwitchUsbSettings.