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


OEM iPhone 11 PRO X/XR XS MAX 8/7 PLUS Fast Charging USB Cable 10 Feet & 6 Feet  picture

OEM iPhone 11 PRO X/XR XS MAX 8/7 PLUS Fast Charging USB Cable 10 Feet & 6 Feet

$2.99



iPhone 13 12 11 PRO MAX XR XS 8/7/6 Fast Charger USB Data Cable cord 10 feet/3M picture

iPhone 13 12 11 PRO MAX XR XS 8/7/6 Fast Charger USB Data Cable cord 10 feet/3M

$4.99



10 Feet/3M For iPhone 13 12 11 PRO MAX MINI  X XR XS 8 7 Fast Charging USB Cable picture

10 Feet/3M For iPhone 13 12 11 PRO MAX MINI X XR XS 8 7 Fast Charging USB Cable

$5.00



10 Foot/3M iPhone 12/11 PRO MAX X/10 XR XS 8/7 FAST Charging USB LONG Cable cord picture

10 Foot/3M iPhone 12/11 PRO MAX X/10 XR XS 8/7 FAST Charging USB LONG Cable cord

$4.98



Genuine A1417 OEM Battery Apple Macbook Pro 15 Retina A1398 Mid 2012 Early 2013 picture

Genuine A1417 OEM Battery Apple Macbook Pro 15 Retina A1398 Mid 2012 Early 2013

$37.90



NEW OEM Battery A1466 A1369 A1496 A1405 A1377 A1466 for MacBook Air 13 inch picture

NEW OEM Battery A1466 A1369 A1496 A1405 A1377 A1466 for MacBook Air 13 inch

$31.90







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