BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-28-2009, 03:08 PM   #1
boomslang
New Member
 
Join Date: Jan 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 8
Default Writing files to disk

Please Login to Remove!

I need my app to do a little caching and so would like to write a few small files to disk. It looks like there are half a dozen ways to store data in the API. Looking through forum posts, the most common method I see is the FileConnection method which looks like it will work great.

One question - Where should I store my files? Is there any convention on where app data should be stored? Most examples I see are reading and writing to the /store/samples/... directories which seems weird to me.

Does anyone know of a good tutorial on reading and writing to disk on blackberries?
Offline  
Old 01-28-2009, 05:07 PM   #2
boomslang
New Member
 
Join Date: Jan 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 8
Default

Followup question: As this file is going to be used as a cache of sorts, I would rather not have it be browsable on the device if possible, so if I could keep it out of the base directory structure that would be much better.

Is there anything like the hidden application_data directory on a Window's machine? Or even better, is there anything parallel to the sandboxing infrastructure provided on the iPhone and Android platforms which gives you a place to store files which only your app can access?
Offline  
Old 01-28-2009, 09:08 PM   #3
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Sounds like what you want to use is the PersistentStore.
Offline  
Old 01-29-2009, 01:25 PM   #4
RLord321
Knows Where the Search Button Is
 
Join Date: Sep 2007
Location: Delaware
Model: 8310
Carrier: AT&T
Posts: 23
Thumbs up

Yes. The PersistentStore will work but keep in mind that using this will require you to get keys to sign your application. Otherwise you won't have the authority to run your application on the device -- it will run on the emulator, however.
Offline  
Old 01-29-2009, 01:39 PM   #5
boomslang
New Member
 
Join Date: Jan 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 8
Default

I have looked into the persistentStore, and it would be ideal. However, although the API does not really specify size guidelines, in a different forum post I read that the persistentStore was somewhat limited in space. I am not sure what 'limited' means. While the cache would usually be quite small, in the rare case it would have the potential to grow as large as 30-40 Mb.

Does anyone know the limitations of the persistentStore?
Offline  
Old 01-29-2009, 02:29 PM   #6
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Check out this thread for size limitation.

You may be back to FileConnection which would allow you to write to an SDCard. 30-40 Mbytes would be pushing the limits for internal storage except for the Bold or Storm. Older devices only have 64MB of memory, and some of that is going to be used for other things.
Offline  
Old 01-29-2009, 03:01 PM   #7
boomslang
New Member
 
Join Date: Jan 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 8
Default

Thanks. That is exactly what I was wondering.

Which kind of brings me back to the original question. If I have to store it in the traditional directories, is there a conventional place to store application data, or do I just put it in something like:

/store/home/user/[my_app]/[my_cache_data]
or
/SDCard/BlackBerry/[my_app]/[my_cache_data]

Out of these, I guess I would have to use the second. I am sure the first stores on the memory of the device which faces the same problems and the persistentStore
Offline  
Old 01-30-2009, 09:01 AM   #8
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Yes, that is correct (though I'm not certain about the path you specify for device memory). The problem is that files on the SDCard won't have the protection you were looking for. Since you have a Storm you could make PersistentStore work for you, but your users may not be so lucky.

Last edited by hrbuckley; 01-30-2009 at 09:05 AM..
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


US Stock 110VAC 60W 40KHz Ultrasonic Cleaning Transducer Cleaner & Driver Board picture

US Stock 110VAC 60W 40KHz Ultrasonic Cleaning Transducer Cleaner & Driver Board

$50.53



Emerson 809-3000 Semiconductor Refrigerant Transducer 12-24V AC picture

Emerson 809-3000 Semiconductor Refrigerant Transducer 12-24V AC

$225.00



YORK 025-28678-008 DESC TRANSDUCER STOCK #K-2311 picture

YORK 025-28678-008 DESC TRANSDUCER STOCK #K-2311

$220.50



three in one Transducer Probe for CONTEC Fetal Monitor CMS800G picture

three in one Transducer Probe for CONTEC Fetal Monitor CMS800G

$299.00



CR Magnetic CR4180-20 True RMS AC Current Transducer 3 Element - New picture

CR Magnetic CR4180-20 True RMS AC Current Transducer 3 Element - New

$229.95



60W 40KHz Silvery Ultrasonic Piezoelectric Transducer High Conversion Efficiency picture

60W 40KHz Silvery Ultrasonic Piezoelectric Transducer High Conversion Efficiency

$18.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.