文件系统:SD卡支持 [英] file-system: SD-Card support
问题描述
据我所知文件系统.knownFolders仅支持
As far as i see the file-system.knownFolders only supports the
- 应用程序
- 数据
- 温度
文件夹.有什么方法可以访问SD卡之类的外部存储吗?
folders on the device storage. Is there any way how to access external storage like SD-Cards?
推荐答案
我进行了一些研究,发现可以使用android.os.Environment.getExternalStoragePublicDirectory(...).toString()
访问设备存储上的某些目录.此方法将返回所需文件夹的路径,然后您可以使用NativeScript方法在此文件夹中读取和写入文件.访问SD卡应该是类似的东西.关于这一点,您还可以查看我正在访问其中的Download
文件夹的项目的示例.所有文件的设备和console.log名称.
I have made a little research and found that you could access some directories on the device storage using android.os.Environment.getExternalStoragePublicDirectory(...).toString()
. This method will return the path to wanted folder and then you could use NativeScript method to read and write files in this folder. For accessing SD Card should be something similar. In regard to that you could also review my sample project where I am accessing Download
folder of the device and console.log names of all files.
您还可以查看以下附件链接:
You could also review below attached links:
https://developer.android.com/guide/topics/data/data-storage.html
这篇关于文件系统:SD卡支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!