[
https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13559719#comment-13559719
]
Andrew Grieve edited comment on CB-285 at 1/22/13 5:37 PM:
-----------------------------------------------------------
I'd like to list out all of the potential storage areas, and then let's talk
about whether we should map them to a requestLocalFilesystem constant.
Android (http://developer.android.com/guide/topics/data/data-storage.html):
*Resources.raw*
- no URL mapping
- read-only
- no subdirectories
- iteration through reflection only?
*Assets directory*
- file://android_assets (URL mapping works only for initial page load?)
- read-only
- includes www directory
*Internal app storage*
- file:///data/data/$PACKAGE_NAME/files
- read-write
- Use Context.openFileOutput / Context.fileList
*Internal cache*
- file:///data/data/$PACKAGE_NAME/cache
- Context.getCacheDir()
*External app storage*
- file:///sdcard/Android/data/$PACKAGE_NAME/files
- or this?: content://com.android.htmlfileprovider/
- Context.getExternalFilesDir()
- Requires WRITE_EXTERNAL_STORAGE permission
*External cache*
- file:///sdcard/Android/data/$PACKAGE_NAME/cache
- Context.getExternalCacheDir()
- Requires WRITE_EXTERNAL_STORAGE permission
*External root (Root sdcard)*
- file:///sdcard
- Context.getExternalFilesDir(null) or
Environment.getExternalStorageDirectory()
- Requires WRITE_EXTERNAL_STORAGE permission
*External media (shared files)*
- file:///sdcard/Music / Photos / etc.
- Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
- Requires WRITE_EXTERNAL_STORAGE permission
Complicated enough? :P
Looking at our current implementation of requestLocalFilesystem(), we use:
PERSISTENT ==> "External root" if sdcard is mounted, "Internal app storage"
otherwise (minus the "/files" suffix)
TEMPORARY ==> "External cache" if sdcard is mounted, "Internal cache" otherwise.
I'll dig into iOS next.
was (Author: agrieve):
I'd like to list out all of the potential storage areas, and then let's
talk about whether we should map them to a requestLocalFilesystem constant.
Android (http://developer.android.com/guide/topics/data/data-storage.html):
- Resources.raw
- no URL mapping
- read-only
- no subdirectories
- iteration through reflection only?
- Assets directory
- file://android_assets (URL mapping works only for initial page load?)
- read-only
- includes www directory
- Internal app storage
- file:///data/data/$PACKAGE_NAME/files
- read-write
- Use Context.openFileOutput / Context.fileList
- Internal cache
- file:///data/data/$PACKAGE_NAME/cache
- Context.getCacheDir()
- External app storage:
- file:///sdcard/Android/data/$PACKAGE_NAME/files
- or this?: content://com.android.htmlfileprovider/
- Context.getExternalFilesDir()
- Requires WRITE_EXTERNAL_STORAGE permission
- External cache
- file:///sdcard/Android/data/$PACKAGE_NAME/cache
- Context.getExternalCacheDir()
- Requires WRITE_EXTERNAL_STORAGE permission
- External root (Root sdcard)
- file:///sdcard
- Context.getExternalFilesDir(null) or
Environment.getExternalStorageDirectory()
- Requires WRITE_EXTERNAL_STORAGE permission
- External media (shared files)
- file:///sdcard/Music / Photos / etc.
- Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
- Requires WRITE_EXTERNAL_STORAGE permission
Complicated enough? :P
Looking at our current implementation of requestLocalFilesystem(), we use:
PERSISTENT ==> "External root" if sdcard is mounted, "Internal app storage"
otherwise (minus the "/files" suffix)
TEMPORARY ==> "External cache" if sdcard is mounted, "Internal cache" otherwise.
I'll dig into iOS next.
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
> Key: CB-285
> URL: https://issues.apache.org/jira/browse/CB-285
> Project: Apache Cordova
> Issue Type: Improvement
> Components: CordovaJS
> Affects Versions: 1.4.0
> Environment: Both PhoneGap SDK and PhoneGap Build
> Reporter: Ashley Gullen
> Assignee: Andrew Grieve
> Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the
> general files added to the PhoneGap project (i.e. the directory index.html is
> in). For example, if I add 'music.mp3' to my project, in Android it will be
> located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path
> like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both
> <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the
> platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that
> uses PhoneGap. Since a framework does not know the App ID or name in
> advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects
> exported by Construct 2 (www.scirra.com), a HTML5 game creator. Also, it
> seems like kind of an important function to make available anyway, since
> hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue:
> http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira