问题
I'm going to run Android app on Chromebook directly to access connected usb devices, not from ARC Welder.
I want to use ES File Explorer to access my usb devices.
Plugin a USB OTG wire and run ES File Explorer on normal Android devices, it can detect connected USB devices as expected.
However, if I run the same ES File Explorer Android app on Chromebook, it can not detect connected USB devices. Looks in this case, Chromebook intercepts USB low level data packages. Because I can use Chromebook built-in File Explorer(which is not an Android app) to access connected USB devices.
By the way, I'm using USB storage to do the test.
So my question is, how can an Android app access connected USB devices on Chromebook? Is current behavior by design? Is there any plan to add USB support for Android apps in the future?
回答1:
Based on the following Chromium bug report:
https://bugs.chromium.org/p/chromium/issues/detail?id=660189
Summary: It appears that access to external/USB storage (read and write) for container based Android Apps on ChromeOS (container ARC) is a known issue, appears to be on the roadmap, but behind other priorities.
Update 2017-11-30:
The Chromium team has implemented USB On-The-Go access for the SD card on ChromeOS 62 (Chromium M-61?) or higher. What this means is that developers who expect their apps to work with the SD card as if it was under the battery in their phone will be disappointed. This is due to the fact that a 'hot swappable' SD card such as those found on a Chromebook isn't considered Adoptable Storage by the Android Framework.
Additionally if you want to use the MediaStore APIs to access it, you are still out of luck as the Android Framework does not support access to removable hardware. The Chromium team is aware and considering options:
Old issue ticket: https://bugs.chromium.org/p/chromium/issues/detail?id=789045&desc=3
So what to do?
Use: Android Storage Access Framework
See this Commonware's post on Removable Storage for further details.
Update 2019-09-04
ChromeOS 72 onward is supporting Android's MediaStore API, and direct '/storage' support for accessing content on SD card.
See: https://bugs.chromium.org/p/chromium/issues/detail?id=789045#c98
Issue ticket for supporting Android's Adoptable Storage: https://bugs.chromium.org/p/chromium/issues/detail?id=917451
来源:https://stackoverflow.com/questions/44104753/cant-find-usb-devices-using-android-app