Android app on Chromebook to access USB devices?

一笑奈何 提交于 2019-12-24 15:11:14

问题


I am taking an Android app and making it run on Chrome using the ARC Welder. For best results we're only targeting the Chromebook / Chrome OS, not Windows or OSX.

The app is running with some minor glitches, but I need to enumerate photos on an inserted SD card.

The problem is that the /mnt folder accessible within Android Runtime only contains the virual sdcard folder, and does not reflect the real SD Card or USB Flash Drives attached to the Chromebook.

How can these photos be automatically loaded from the SD Card into the Android App in the Android Runtime.

I know that I could use a CRX (Chrome Extension) to read the SD Card photos, but how could they be passed to the Android app? And can this be in the same CRX as the ARC Welder creates or must it be a separate CRX?


回答1:


I found a workaround which is to use the Additional Metadata section and add
{ "enableExternalDirectory": true }.

When the app first launches, it prompts the user for the folder. One must select the SD card.

Then my app works as expected, as the 'emulated sd card' becomes the 'real sd card'. This is not the most user-friendly approach, but it works.

I'd still prefer if we could load the files from a CRX into the Android Runtime...



来源:https://stackoverflow.com/questions/36748350/android-app-on-chromebook-to-access-usb-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!