20

Android 6.0 Developer Preview (API level 23) can natively mounts external removable USB OTG storages out-of-the-box without any additional apps (for more info please see: https://www.androidpolice.com/2015/05/28/android-m-feature-spotlight-external-storage-can-be-adopted-as-true-internal-storage-or-accessed-normally-with-no-additional-apps/).

When user connects USB OTG storage, it shows up in the system storage menu and it is accessible with the built-in file manager. User can access all files on the USB OTG external storage using the new built-in file manager without root rights.

When I connect my USB OTG storage to my Android device, it mounts at /storage/A03E-1DF5 and also at /mnt/media_rw/A03E-1DF5, but root rights required to access this folder.

I'm working on Android media player app.

Is it possible and how to access files on USB OTG storages on Android 6.0 in my app like the built-in file manager without root rights?

P.S. I already use checkSelfPermission and requestPermissions functions in my app and my app already has android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE (for more info please see: https://www.androidpolice.com/2015/07/15/android-m-feature-spotlight-apps-now-need-your-permission-to-read-and-write-to-external-storage/), but looks like these permissions only affects internal storages (MicroSD), and for USB OTG there is no such granular permission.

4

1 回答 1

13

从 Android 6 开始,根据USB 媒体支持文档,存储访问框架似乎是唯一可用的机制:

在 Android 6.0 中,任何未采用的设备都被视为便携设备。[...] 第三方应用程序必须通过存储访问框架才能与便携式存储上的文件进行交互;出于隐私和安全原因,直接访问被明确禁止。

于 2015-11-10T09:18:20.650 回答