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

Made getRealExternalStorageDirectory static and public and changed the dataPath location to use Android standards #1492

Merged

Conversation

falcon4ever
Copy link
Contributor

@arturoc This a small update to my previous patch

  1. Made getRealExternalStorageDirectory static and public.
    This way you can use this method in your application as well if needed.
  2. Changed the dataPath location to the proper storage location.
    According to the official developer guide, files written to the external storage should be placed in: /Android/data/<package_name>

More information can be found in the Android guide: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal section Accessing files on external storage

This will also help to keep the SDcard clean and prevents assets from being indexed as /Android/data usually contains a .nomedia file.

This way you can use this method in your application as well if needed.

2. Changed the dataPath location to the proper storage location.
According to the official developer guide, files written to the external storage should be placed in: /Android/data/<package_name>

More information can be found in the Android guide: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal section Accessing files on external storage

This will also help to keep the SDcard clean and prevents assets from being indexed as /Android/data usually contains a .nomedia file.
@arturoc
Copy link
Member

arturoc commented Aug 21, 2012

a couple of things, can you make the variable private again? the method is ok as public static but i think it's better to keep the variable as private in case we need to change it in the future with only the method as public it's easier to mantain compatibility with older projects

also, even if this is the right directory to put application data, it's going to break old applications storing configuration in the current location. what if we added some code that checks if the old location exists and moves the directory to /sdcard/Android? we can remove that code in a couple of versions

@falcon4ever
Copy link
Contributor Author

@arturoc Sounds good, I'll make the array private again and will start working on some code that detects whether the old directory exists and needs to be moved to the new location.

@thiagohersan
Copy link
Contributor

some of this was addressed by this commit.

I'd +1 the move to /Android/data/<package_name>/files/ .

Let me know if I can help with that.

@arturoc
Copy link
Member

arturoc commented Jan 3, 2013

yes we should move to Android/data/package_name, the only thing missing is some mechanism to move the directory for old projects if it exists at the root level, i think it should be done in the c++ side if you want to take a look

Added a check to see if the old data location exists. If it does, data will be moved to the new storage location.
@falcon4ever
Copy link
Contributor Author

@arturoc & @thiagohersan : Sorry for the delay, I've implemented both suggested fixes in the latest commit.

@bilderbuchi
Copy link
Member

@falcon4ever watch out, currently your PR can't be merged because of a merge conflict. probably because you made some changes which touched code someone else changed in the meantime. in your local repo, fetch current develop, merge it into your PR branch, and fix the appearing merge conflict, then push your PR branch again.

@falcon4ever
Copy link
Contributor Author

@bilderbuchi Ok I'll try to merge it with the latest develop in a bit.

@falcon4ever
Copy link
Contributor Author

@bilderbuchi Ok, I sorted out the conflict and I think it should be merged alright now.

@arturoc
Copy link
Member

arturoc commented Jan 4, 2013

looks great, thanks!

arturoc added a commit that referenced this pull request Jan 4, 2013
…efix2

Made getRealExternalStorageDirectory static and public and changed the dataPath location to use Android standards
@arturoc arturoc merged commit 7fa13a5 into openframeworks:develop Jan 4, 2013
@falcon4ever falcon4ever deleted the develop-0071-android-storagefix2 branch January 4, 2013 09:30
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

Successfully merging this pull request may close these issues.

4 participants