file-system: SD-Card support

情到浓时终转凉″ 提交于 2020-01-25 20:45:45

问题


As far as i see the file-system.knownFolders only supports the

  • Application
  • Data
  • Temp

folders on the device storage. Is there any way how to access external storage like SD-Cards?


回答1:


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

  2. Write a file in external storage in Android

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



来源:https://stackoverflow.com/questions/37768820/file-system-sd-card-support

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