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?

I've seen other SO questions and the answers are not really sufficient (e.g., Android: Detecting USB).

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top