title: Programmatically Turn Off USB Storage on Android Devices
body: <p>On many android devices, when the device is plugged into the USB port of a computer or even on some USB charging devices, the phone goes into USB Storage mode. When the device is in this mode, android apps cannot access the sdcard. Is there any way (1) to detect when the device is in this mode and (2) to programmatically turn off USB storage, at least temporarily, so my android app can access the sdcard?</p>
  
  <p>I've seen other SO questions and the answers are not really sufficient 
  (e.g., <a href="https://stackoverflow.com/questions/4600896/android-detecting-usb">Android: Detecting USB</a>).</p>