75081

Android 4.4 - create application dir on secondary sd card

Question:

I am aware about changes in Access to SD card introduced by Google with Android 4.4. However in my application I need to be able to store data on some removable /secondary sd card.

When I create the application folder (app.xyz.com) on the secondary using default file manager then I am able to create dirs and files inside. But by default such dir dosen't exist on secondary sd card.

So, I would like to create the application specific dir programmatically inside my application…

Do you have any idea how to do this??? Simple file.mkdirs(), even with the correct application related path, doesn’t work. Permission error…

I have spend already two days trying to find a way, without any success

THANKS FOR YOUR HELP!!!

Answer1:

<blockquote>

Do you have any idea how to do this?

</blockquote>

Use getExternalFilesDirs() (note the plural). If that returns more than one entry, the second and subsequent ones are on removable media. Those directories you can read and write to without any permissions on Android 4.4.

Recommend

  • Triggers and disabling “row(s) affected” message
  • CodeCoverage with PHPunit not generating
  • URL Rewrite Including Trailing Slash If Not Present
  • Select Earliest Order for a set of tests in a daterange SQL
  • How to search a string in inner array using mongodb?
  • how to delete a file's on uninstall the android application? [duplicate]
  • Save and retrieve an image file in LibGDX
  • Move an object (element) one step up with Javascript
  • Modifying files nested in tar archive
  • Replace and retrieve placeholder value
  • auth.provider is not set to 'password' when user signs-in with email and password
  • Geom_jitter colour based on values
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • List images(01.png) and descriptions(01.txt) from directory
  • Copy to all folders batch file?
  • Xcode 4 NSLog Macro link in Xcode 3
  • How to test if a URL from an Eclipse bundle is a directory?
  • Paperclip, set path outside of rails root folder
  • req.body is undefined - nodejs
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Modifying destination and filename of gulp-svg-sprite
  • Symfony2: How to get request parameter
  • Why winpcap requires both .lib and .dll to run?
  • Akka Routing: Reply's send to router ends up as dead letters
  • GridView Sorting works once only
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • Comma separated Values
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Error creating VM instance in Google Compute Engine
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Hits per day in Google Big Query
  • coudnt use logback because of log4j
  • how does django model after text[] in postgresql [duplicate]
  • File not found error Google Drive API
  • Qt: Run a script BEFORE make
  • Append folder name and increment by 1 using batch script