62202

file-system: SD-Card support

Question:

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

<ul><li>Application</li> <li>Data</li> <li>Temp</li> </ul>

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

Answer1:

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 <a href="https://github.com/tsonevn/ReadFilesFromDevice.git" rel="nofollow">project</a> where I am accessing Download folder of the device and console.log names of all files.

You could also review below attached links:

<ol><li>

<a href="https://docs.nativescript.org/cookbook/file-system" rel="nofollow">https://docs.nativescript.org/cookbook/file-system</a>

</li> <li>

<a href="https://stackoverflow.com/questions/8330276/write-a-file-in-external-storage-in-android" rel="nofollow">Write a file in external storage in Android</a>

</li> <li>

<a href="https://developer.android.com/guide/topics/data/data-storage.html" rel="nofollow">https://developer.android.com/guide/topics/data/data-storage.html</a>

</li> </ol>

Recommend

  • What is the use of a session store?
  • How to skip require in ruby?
  • Saving image to sd with current date and time in name doesn't work
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Yii2: Config params vs. const/define
  • Disable Enter in editText android
  • Cannot resolve symbol 'MyApi'
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Spring security and special characters
  • Volley JsonObjectRequest send headers in GET Request
  • Obtain ObjectIdHex value from mgo query
  • Incrementing object id automatically JS constructor (static method and variable)
  • Javascript convert timezone issue
  • Trying to switch camera back to front but getting exception
  • Eraser for UIBezierPath
  • How to limit post in wp_query
  • Upload files with Ajax and Jquery
  • Build own AppleScript numerical error handling
  • Release, debug version and Authorization Google?
  • Apache 2.4 - remove | delete | uninstall
  • 0x202A in filename: Why?
  • Cannot Parse HTML Data Using Android / JSOUP
  • AngularJs get employee from factory
  • Free memory of cv::Mat loaded using FileStorage API
  • How do you join a server to an Active Directory (domain)?
  • Angular 2 constructor injection vs direct access
  • Understanding cpu registers
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Java static initializers and reflection
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • Change div Background jquery
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • apache spark aggregate function using min value
  • Bitwise OR returns boolean when one of operands is nil
  • Is there any way to bind data to data.frame by some index?
  • Django query for large number of relationships
  • Programmatically clearing map cache
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?
  • How to push additional view controllers onto NavigationController but keep the TabBar?