Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified
Accepted Solution

is there a /tmp directory or similar directory as in linux on a blackberry?

Hi all,

 

I would like to store some temporary files and not sure if there is some temporary directory that I could use?

 

Thank you for your help.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: is there a /tmp directory or similar directory as in linux on a blackberry?

In blackberry device memory there is no filesystem like FAT, FAT32, NTFS etc.

 

Blackberry device memory is like a big hashtable.

 

I recommend to look at Blackberry Developer Guide (there are 2 books/parts).

 

It can be downloaded here:

 

App. Developer Guide. Part 1

 

App. Developer Guide. Part 2

 

Check the part 2. There is information how to work with persistent memory.

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: is there a /tmp directory or similar directory as in linux on a blackberry?

You will find that all current BlackBerries support JSR 75 - FileConnectionAPI, which will provide you with a file oriented storage mechanism.

 

The documentation that tbilisoft has pointed you at will not mention this, as it is filially old, but you will find more current documentation here:

http://na.blackberry.com/eng/support/docs/subcategories/?userType=21&category=BlackBerry+Java+Applic...

 

There is some information about FileConnection API in the multimedia guide.  In addition, you find further information on this forum and in the Javadocs and on the web, since this is not a Blackberry specific API.

Developer
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified

Re: is there a /tmp directory or similar directory as in linux on a blackberry?

Hi Peter & Tlibisoft,

 

Your info  is really helpful to me. I think I have a good idea of where to start already. I want to develop an application that can work on a phone with SDcard or without SDcard therefore I was looking for a common directory to put my files.

From reading the document, it seems that I can put the file in directory "file:///store/home/user/" and that directory will be common to all devices, am I right?

 

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: is there a /tmp directory or similar directory as in linux on a blackberry?

This KB article will be of use.

 

How To – Programmatically determine if a microSD card has been inserted
Article Number: DB-00560

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1295814/How_To...

 

I'm not 100% sure that /store is available on all devices.  It is clearly not available on devices with OS pre 4.2.  However the case of OS's after 4.2 is not certain.  For example, you can run OS 4.5, which in theory supports FileConnection, on an 8700 device, which has no SDCard.  In this case, I thought you could configure some of the memory as an internal card, but I don't know how to do this, and there does not seem to be any obvious way on the 8700 with OS4.5 I have here.

 

If you want a method that will work on all devices, then you have go with PersistentStore.

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: is there a /tmp directory or similar directory as in linux on a blackberry?

As mentioned before FileConnections API is not available for RIM OS older than 4.2

 

And if you plan to run your application on older OS-es too then use persistent store and store java objects instead of storing files.