BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-08-2009, 05:37 AM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9500
PIN: N/A
Carrier: None
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Where should I store application data files?

Please Login to Remove!

In application I'm working on I need to store several data files. These data files should be unpacked on first start and them periodically updated from web.

I'm developing for Storm (9500, 9530). I expected to have private directory for application. As I understand "fileconn.dir.private" is not supported by System.getProperty() on BlackBerry.

Is there application private directory at all and how to find path to it?
Or where should I store application data files?
Offline  
Old 07-08-2009, 06:13 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

use a persistentstore class: RIM Device Java Library: Class PersistentStore
Offline  
Old 07-08-2009, 06:40 AM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9500
PIN: N/A
Carrier: None
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I considered PersistentStore, but I don't want to use it for two reasons:
  • As I understand it is designed as a way to serialize/deserialize objects to/from device. Thats not exactly where my needs are. These data files fall into several objects of different classes when data is read.
  • More important that I'm porting this functionality from Android version of application and want to keep architecture of both projects as close as possible.

Anyway thanks for spending your time on my problem.
Offline  
Old 07-08-2009, 08:58 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Did you look at FileConnection?

It is in the API docs.
Offline  
Old 07-08-2009, 03:16 PM   #5 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9500
PIN: N/A
Carrier: None
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I'm using FileConnection to work with files (retrieve input and output streams, check file existence, create/delete directories and files).

I need to know where should I store private files. For example, on Android each application has private directory where it is recommended to store data files and there is API method that returns path to this directory. Is there something similar on Blackberry?
Offline  
Old 07-08-2009, 11:03 PM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Never come across any such directory. PersistentStore is the way to go, if you want to stay close to file semantics save them as a Hash of Strings with Strings as the key.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 08-19-2009, 11:52 PM   #7 (permalink)
New Member
 
Join Date: Aug 2009
Model: none
PIN: N/A
Carrier: none
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by hrbuckley View Post
PersistentStore is the way to go
PersistentStore seems appropriate for long-term persistence. But what if you just want to save temporary files? I see that System.getProperty("java.io.tmpdir") returns null. And there's no File.createTempFile() method. PersistentStore could still be used for this but is it the best practice?
Offline  
Old 08-20-2009, 09:01 AM   #8 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

It depends. It is a compromise between work to encode/decode objects and memory and object handles available for the stores.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 08-21-2009, 01:42 AM   #9 (permalink)
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by andreware View Post
I need to know where should I store private files. For example, on Android each application has private directory where it is recommended to store data files and there is API method that returns path to this directory. Is there something similar on Blackberry?

unlike Android, no private directory. I had a similar issue and we created our own directory structure and stored data in encrypted form to disallow other applications from using the data. Depending on size of data you may decide between persistent store and file connection.
If you've already found a solution to ur issue, please share it on the forum
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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