|making temporary files||Jason Proctor||10/3/08 3:02 PM|
is there a good spot in the filesystem to park temporary files?
i notice from rummaging around that there is no /tmp on this Linux
(and android error messages should be more informative in general, IMHO.)
|Re: making temporary files||Justin (Google Employee)||10/3/08 5:04 PM|
You should put temporary files somewhere in /sdcard, as generally this
will have more available space than a device's internal storage. For
this to work you need to use emulator options to specify an sdcard
image that was created with the mksdcard utility.
You're getting the error you're getting because /sdcard doesn't exist
since you haven't specified an sdcard image file.
Android Team @ Google
|[android-developers] Re: making temporary files||Jason Proctor||10/3/08 5:12 PM|
thanks for the response.
supposing i'm running on a real device and the user doesn't have an
|Re: making temporary files||MrSnowflake||10/5/08 5:47 AM|
The G1 from t-mobile will be delivered with a 1GB MicroSD, but when
it's not present you could make an error dialog which says you program
needs an SD card.
|Re: making temporary files||hackbod||10/6/08 12:15 AM|
Well... you can make a temp file wherever you want. Depending on
what you want to do, either the SD card or your own internal data
directory would make sense. The trade-offs are:
(1) The internal data directory is secure, so if you are putting ANY
private information (passwords, mail messages, chat data, etc) in the
temp file you should put it in internal storage.
(2) The SD card generally has a lot more storage available, so if you
are going to be writing multiple megabytes of data then the SD card is
a better choice.
(3) The SD card may not be available... but in that state the camera
can't take pictures, etc, so it should be unlikely.
|[android-developers] Re: making temporary files||Jason Proctor||10/6/08 1:17 PM|
thanks for the response.
IMHO the Android filesystem should have a /tmp directory, which is
also IMHO, File.createTempFile() should *always* create a file which
|Re: making temporary files||hackbod||10/6/08 3:03 PM|
No it shouldn't. :)
Temp directories suck. When do you remove those files? If it's on
the SD card, who owns them? Especially with a limited out of storage
space, it's just a big nasty mess that is best to avoid.
So you can make your own temp files, and if you want them in internal
flash then you have to put them in your own directory, where the
system can appropriately bill them against your use of storage. And
you can decide when to delete them, when you are done with them.
|[android-developers] Re: making temporary files||Jason Proctor||10/7/08 1:54 AM|
oh yes it should :-)
ok so maybe the unconventional Android application lifecycle changes
but still, trusting those applications to keep track of their
and none of this changes the fact that File.createTempFile() should
if in doubt, have a convention. that way there will be at least a
|Re: [android-developers] making temporary files||Tom Gibara||10/7/08 2:14 AM|
I have to disagree with your disagreeing :)
There are two fairly common and well defined situations:
Situation: You need a temp file to do some processing that won't necessarily fit into memory.
Solution: Create the file, use it, delete it when you're done*
Caveat: The file may be exceptionally large: demand an SDCard. The file contains sensitive information: use app storage.
Situation: You are operating a cache.
Solution: maintain the files in the supplied cache directory (Context.getCacheDir()), the system knows these can be deleted**
Caveat: Big ticket items (like songs and videos) go to the sdcard (the user can treat these types as useful files anyway)
How does the availability of createTempFile() effect any solution in these two cases?
* Concerned about termination? Persist the name of your temporary file before starting work, clear it when you're done, check for it on start-up and delete it if present.
** I'm only assuming this is what the system will do.
2008/10/7 Jason Proctor <ja...@redfish.net>
|Re: making temporary files||hackbod||10/7/08 10:10 AM|
You can just as well do those things yourself without
createTempFile(). I am strongly against createTempFile() because it
has no idea what you are doing with your file, how long to keep it
around, who you might share it with, etc. Note that the API doesn't
even meet the requirements you are giving, where you store the file
either on the SD card or internal storage based on what you are doing
|Re: [android-developers] Re: making temporary files||Tom Gibara||10/7/08 2:07 PM|
Was that reply aimed at me? I was in agreement!
I've seen several server apps collapse through abuse of createTempFile(). The semantics are weak: almost to the point of being dangerous :)
2008/10/7 hackbod <hac...@gmail.com>
|Re: making temporary files||hackbod||10/7/08 3:18 PM|
Whoops! Sorry, yeah it was incorrectly aimed at you, I thought you
were disagreeing with me. :)
> 2008/10/7 hackbod <hack...@gmail.com>
|[android-developers] Re: making temporary files||Jason Proctor||10/9/08 11:34 PM|
OK i basically give in on the temporary file issue.
i still think it's idealistic to expect applications to clean up
on the subject of File.createTempFile(), i still think that the
so there ;-)
|unk...@googlegroups.com||12/10/12 8:03 AM||<This message has been deleted.>|