I noticed a few apps use the convention:

<External Storage Location>/Android/data/<package name>

For example, Google Earth places its cache on my Nexus One at /sdcard/
Android/data/com.google.earth

Is this is a good standard to follow?

It would be really good if there were at least some guidelines to
follow.

On a related note, I would love there to be a method like:

Environment.getAppExternalStorageDirectory()

which might, in the above example, return the directory: /sdcard/
Android/data/com.google.earth

but most importantly, the app would be blissfully unaware of the exact
location.

Even better, you could add a manifest permission allowing the app to
only access that folder (and sub folders etc). This would stop apps
from accessing/deleting other sdcard data it should not have anything
to do with.

On Jan 11, 11:43 am, Andriy Zakharchuk <[email protected]>
wrote:
> Hello Dianne,
>
> thank you for clarification. But I have one more question.
>
> Everything you've said makes sense when we talk about internal
> application files (configurations, temporarily storage whatever else).
> However, there are few other cases. In my case I need to implement
> backup/restore function. In this case I guess the user has to know the
> directory where the files are stored (later backup files might be
> copied to another storage). If the user can not configure this, then
> he/she might have difficulties with finding backup files (at least the
> directory is not obvious).
>
> So I think that before writing backup files toSDcardwe need to let
> user to specify the directory where these files should be stored. We
> still can use API to preset directory selection screen with some value
> (e.g., /sdcard/<application-name>/backups), but we want to let user
> choose the directory, so later when devicecardis mounted to the
> desktop, the user could be sure he/she finds the files in the
> specified directory.
>
> Does it make sense?
>
> On Jan 4, 11:14 am, Dianne Hackborn <[email protected]> wrote:
>
>
>
> > On Sun, Jan 3, 2010 at 11:11 PM, Alessandro Pellizzari 
> > <[email protected]>wrote:
>
> > > Please also consider devices with more than oneSDcard, like the
> > > Samsung Galaxy (/sdcard is the internal 6.5 GB flash, /sdcard/sdis the
> > > external removableSDcard).
>
> > In theory, your app should do nothing special about this.  There is a public
> > API to get the path the external storage; you should use that, and never
> > hard-code paths.
>
> > Currently the platform only supports one external storage location, so I
> > would suggest using that and staying blissfully unaware of whatever other
> > stuff Samsung does.  Unless they provide their own well-defined API to their
> > own storage paths (via a library your app can link to), or contribute a
> > patch to the platform to support other kinds of external storage, you should
> > treat whatever else they are doing as non-existent: you have no way to know
> > if that will exist in the future in the current form or at all.
>
> > If you need to store big chunks of data, you could let the user
>
> > > configure the path in which to save them.
>
> > That's one of the things we really don't want applications doing. :}  We try
> > very hard to keep paths out of the UI for users; for some specific kinds of
> > apps it can make sense to expose them (such as file browsers), but users
> > should not be confronted with paths when dealing with normal applications.
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to