你怎么能访问谷歌电视上的外部存储器你怎么、存储器、电视

2023-09-06 04:45:24 作者:她不在了i

我正在开发使用的是索尼的互联网电视作为开发设备,它具有4个USB端口。所有或没有端口可用于与外部的硬盘驱动器。如何选择和访问外部存储器VS设备上的内部存储器。

I'm developing using a Sony Internet TV as a development device, which has 4 USB ports. All or no ports can be used with external hard drives. How can I select and access external memory vs internal memory on the device.

我能够访问SD卡,或者至少是与SD卡使用以下的电视标签

I'm able to access the SD card, or at least what the TV labels as the SD card using the following:

Environment.getExternalStorageDirectory();

不过,我似乎无法弄清楚如何找到外接USB设备。我试图下井UsbManager类的路径,但它好像应该有一种更简单,更普遍的方式。我只是希望能够看到的海量存储设备,并且不希望有通过供应商的ID等清洁,但也许我失去了一些东西在那里。

But I can't seem to figure out how to find external USB devices. I've attempted to go down the path of the UsbManager class, but it seems as though there should be an easier and more general way. I just want to be able to see mass storage devices and don't want to have to clean through vendor id's etc. But maybe I'm missing something there.

这应该是可能的,因为我正在寻找的媒体播放器应用程序,打开菜单并选择选择设备时发现了相同的功能。

This should be possible as I'm looking for the same functionality found by the Media Player app when opening the menu and selecting "Select device".

我只需要读取访问该驱动器,但读/写可能是有用的。

I only need read access to the drives, but read/write could be useful.

在此先感谢。

推荐答案

在谷歌电视v2中,有关于USB存储支持一些变化。 对于USB驱动器的主要变化是: 1.USB驱动器将被安装的/mnt/media/usb.XXXXX不是/ SD卡。 (XXXXX是由ID(决定卷ID:VFAT或exFAT的,UUID:USB卷的NTFS)) 2.GTV支持多个USB驱动器。用户可以将多个USB驱动器。

In Google TV v2, there were some changes regarding USB storage support. The major changes for USB drives are: 1.USB drives will be mounted /mnt/media/usb.XXXXX instead of /sdcard. (XXXXX is decided by the ID(volume id : vfat or exfat, uuid : ntfs) of USB volume.) 2.GTV supports multiple USB drives. Users can plug multiple USB drives.

MediaProvider索引的所有媒体文件中的所有插入USB卷。因此,应用程序可以以取回的所有媒体文件对MediaProvider查询。 样品code:

MediaProvider indexes all the media files in all the plugged USB volumes. So, applications can query against MediaProvider in order to retrieve all the media files. Sample code:

光标光标= getContentResolver()查询(       Images.Media.EXTERNAL_CONTENT_URI,       新的String [] {           Images.Media._ID,           Images.Media.DATA,//文件路径       },       NULL,NULL,NULL);

Cursor cursor = getContentResolver().query( Images.Media.EXTERNAL_CONTENT_URI, new String[] { Images.Media._ID, Images.Media.DATA, // file path }, null, null, null);

如何申请检测当变频器同步或弹出?: 你可以为了获得注册的BroadcastReceiver Intent.ACTION_MEDIA_SCANNER_FINISHED和Intent.ACTION_MEDIA_EJECT。

How can application detect when the drive has synced or ejected?: You can register BroadcastReceiver in order to receive Intent.ACTION_MEDIA_SCANNER_FINISHED and Intent.ACTION_MEDIA_EJECT.