Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-16 Thread Mark Murphy
On Sat, Jun 16, 2012 at 11:33 AM, Terry  wrote:
> Even if a new device is sold without an sdcard, we would still like
> our apps to work.

No device that legitimately has the Google Play Store on it will ship
with less than 1GB of external storage -- it's a requirement.

> So; if a device does not have an sdcard, WHERE would you recommend to
> store data (e.g. picture files)?

Probably you don't store picture files, any more than you would store
picture files on a computer lacking any sort of hard drive. In a
pinch, you can store them on internal storage, but, again, for the
devices you are worried about, internal storage is at a premium.

Please note that a significant percentage -- probably a majority at
this point -- have external storage as part of on-board flash, which
cannot be removed (though, on Android 1.x/2x, may be unavailable if it
has been mounted on a host machine). Also, please note that the space
distinction between internal storage and external storage, and the
external-storage-not-available-when-mounted, issues are mostly cleared
up as of Android 3.0.

> HOW do you get the preferred directory in internal storage?

There is no "preferred directory", insofar as the "preferred
directory" concept implies that the user has access to the files, and
they don't have access to internal storage except via your app (or
except via rooting their phone). You get your internal files directory
via a call to getFilesDir() on any Context.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Mark Murphy
On Sun, Jun 17, 2012 at 4:26 AM, Terry  wrote:
> I checked on a new HTC One V.
>
> There the Environment method getExternalStoragePublicDirectory()
> returns "/mnt/sdcard", which cannot be used for anything. Trying to
> write there fails.
> The external memory is also reported as unmounted.
>
> There IS about 1 GB memory however - at "/mnt/emmc", (which is
> writeable) but that directory is NOT returned by any of the
> Environment methods. This seems to be the required "external" memory
> that you are referring to, but HOW does an app get to know that?

It doesn't.

This sounds like a problem with this device. I will point HTC to this
thread; hopefully we will be able to get to the bottom of this.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Mark Murphy
On Sun, Jun 17, 2012 at 9:49 AM, Chris Stratton  wrote:
>> There is no "preferred directory", insofar as the "preferred
>> directory" concept implies that the user has access to the files, and
>> they don't have access to internal storage except via your app (or
>> except via rooting their phone).
>
> As I've pointed out to you recently on another occasion, this is not
> quite true.  The ability to access files in the private storage area
> from another app is controlled by the access mode settings on those
> files, which is something the owning application can choose.

:: sigh ::

Yes, it is possible to use MODE_WORLD_READABLE and
MODE_WORLD_WRITABLE. I do not recommend it.

In the context of this specific answer, the fact that
MODE_WORLD_READABLE and MODE_WORLD_WRITABLE exist is irrelevant to the
point that I was making in the paragraph you quoted above. The concept
of a "preferred directory" presumes direct user access to browse the
files, and that is not supported for internal storage, regardless of
mode of any individual file. There is nothing on-board a stock Android
firmware to allow users to browse internal storage as a directory
structure, internal storage does not show up when you plug the device
into a host machine via a USB cable, etc.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Mark Murphy
On Sun, Jun 17, 2012 at 10:23 AM, Terry  wrote:
> WIth an SDcard inserted, I tried to download a free ebook. That went
> well.

And the file wound up where? /mnt/sdcard? You said that did not work
("which cannot be used for anything. Trying to
write there fails.")

> However, if I use the built in camera (without an SDcard), it saves
> pictures at /mnt/emmc/DCIM/100MEDIA.

Alternative storage points are available to firmware apps from the
device manufacturer that wrote the firmware apps and built the device.
This appears to generally be used for stuff like the camera, where the
images are then surfaced through MediaStore, and you access them that
way.

> I.e. It seems that the camera app knowns about the piculiarities re
> the internal/external storage of this device.

Of course. HTC wrote the camera app, and HTC built the device. Device
manufacturers always have access to things that are beyond the SDK.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Mark Murphy
On Sun, Jun 17, 2012 at 10:43 AM, Terry  wrote:
> You asked: "And the file wound up where? /mnt/sdcard? You said that
> did not work
> ("which cannot be used for anything. Trying to
> write there fails.") "
>
> Sorry. I could have been a little clearer here. Yes, when the SDcard
> was inserted in the device, the downloaded file was saved on the
> sdcard (on mnt/sdcard/download).
> (When I said that the dirctory  /mnt/sdcard did not work - and could
> not be used for anything - that was when the sdcard was NOT inserted.)
>
> When I insert the SDcard, the build in camera app also starts saving
> pictures on the sdcard (on /mngt/sdcard/DCIM/100MEDIA.

That means your device is behaving within normal parameters.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Mark Murphy
On Sun, Jun 17, 2012 at 12:51 PM, Terry  wrote:
> And that is why I do NOT understand when Mark is saying "hat means
> your device is behaving within normal parameters. "

Ah, now we're getting somewhere. That's a flaw in the distribution of
this device -- whether that is HTC's issue, the carrier's issue, or
simply a hiccup with your individual device, I cannot say.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

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


Re: [android-developers] Re: Where to save data on devices without an sdcard?

2012-06-17 Thread Kostya Vasilyev
To give this discussion a bit more context:

Various manufacturers (primarily HTC and Samsung) have been creating
devices that have this additional memory partition (on top of the memory
card and the internal storage), which can't be found using Android
framework API, for the past two years or so.

The names of these additional mount points vary from manufacturer to
manufacture, and from device to device.

There are various hackish ways to find them (such as keeping a list of
device-specific info in the app, or parsing the Linux mount points, etc.),
but no official discovery / enumeration API.

During these two years, the developers of Android have been ignoring this
issue.

One could hope that the reason for this is that some next version of
Android will fill this need, and that discussing exactly how might bring to
light too much about this next version before it's ready to be announced.

Pure speculation on my part, but with Google IO just around the corner it's
not too long before it becomes more clear.

The alternative explanation is that they just don't think that this
particular gap in the API is worth fixing.

-- K

2012/6/17 Terry 

> Chris;
>
> No, the HTC One V is sold WITHOUT an SDcard.
>
> Regards, Terry
>
>
> On 17 Jun, 18:09, Chris Stratton  wrote:
> > On Jun 17, 10:23 am, Terry  wrote:
> >
> > > You asked "What happens if you try to download something (perhaps a
> > > PDF file)
> > > with the built in browser? "
> >
> > > Good question.
> >
> > > WIth an SDcard inserted, I tried to download a free ebook. That went
> > > well.
> > > Then i removed the SDcard, and tried again.
> > > This time I was informed (by the built in web browser) that an SDcard
> > > was required to be able to download that file.
> > > I.e. It seems that this browser had the same problem with this (HTC)
> > > device that I have.
> >
> > Did the device ship with an sdcard included in the box (assuming you
> > bought it via an official source) ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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