文件系统:SD卡支持 [英] file-system: SD-Card support

查看:99
本文介绍了文件系统:SD卡支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知文件系统.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:

  1. https://docs.nativescript.org/cookbook/file-system

在Android的外部存储设备中写入文件

https://developer.android.com/guide/topics/data/data-storage.html

这篇关于文件系统:SD卡支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆