Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store / Load Filles in External SD Card By Default #135

Open
hallahan opened this issue Apr 9, 2016 · 5 comments
Open

Store / Load Filles in External SD Card By Default #135

hallahan opened this issue Apr 9, 2016 · 5 comments

Comments

@hallahan
Copy link
Contributor

hallahan commented Apr 9, 2016

Interestingly, there is no way to do this in the Android SDK, and Stack Overflow has been misleading.

However, I found the VLC app on Github that does access the SD card, and I found code that lets me do it. I implemented those util functions.

We need to use this and have OpenMapKit store things in the SD card by default, and fall back on standard "external" storage as secondary.

https://github.com/mapsme/omim/blob/master/android/src/com/mapswithme/maps/settings/StorageUtils.java

Also, MAPS.ME has similar code, though it's a little less reusable:

https://github.com/mapsme/omim/blob/32f28f0aa4bc7a0564e002f84d292c6dd1849eaa/android/src/com/mapswithme/maps/settings/StoragePathManager.java

When implementing #19 we should do this.

@hallahan
Copy link
Contributor Author

hallahan commented Apr 9, 2016

@hallahan
Copy link
Contributor Author

hallahan commented Apr 9, 2016

Though I'm able to access the SD card now, I'm unable to create directories in the SD card. Needs further investigation.

Continuing to use external storage until this is resolved (not SD Card).

@hallahan
Copy link
Contributor Author

hallahan commented Apr 9, 2016

Also, DownloadManager.Request doesn't seem to have the ability to write to anything that isn't standard external storage.

http://developer.android.com/reference/android/app/DownloadManager.Request.html#setDestinationInExternalPublicDir(java.lang.String, java.lang.String)

@softworkz
Copy link

How about https://developer.android.com/reference/android/app/DownloadManager.Request#setDestinationUri(android.net.Uri)

It lets you set any target for downloading as long as

  • the target url is a file uri (file://...)
  • it's not an 'internal' target location
  • the initiating client has write permission for the target

@softworkz
Copy link

Did you call File.getCanonicalFile() before trying to create a subfolder on the SD card..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants