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

Web and WebWorks Development

Reply
Contributor
Posts: 24
Registered: ‎10-12-2011
My Device: Lots
My Carrier: All

Where to store BlackBerry WebWorks Application Specific Files?

Hi all,

 

I am developing a BB WebWorks application that both creates and downloads existing files that may contain secure information.  I need somewhere to save these files that is specific to the application and secure.

 

I was hoping that I could use "local:///myfile.ext" as a file path and save documents away to an area that's specific to the application but having tried this doesn't seem possible.

 

Can anyone give me some advise regarding what is and what isn't possible?  Perhaps saving to the SD Card and having the files visible to everything/one is the only option?

 

Thanks in advance.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Where to store BlackBerry WebWorks Application Specific Files?

From the mention of the SD Card I'm assuming you mean on the Smartphone and not PlayBook correct?

 

The Smartphone does not have sandboxed folders that you can apply application permissons to.  So there isn't an area where you can set files aside that can only be accessed by your application.

 

You can store data in a SQLite database that is encypted and can only be accessed by your application.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 24
Registered: ‎10-12-2011
My Device: Lots
My Carrier: All

Re: Where to store BlackBerry WebWorks Application Specific Files?

Hi,

 

Thanks for your reply and clairification.  A datbase isnt' going to be a feasible option because the files can be rather large and so loading the whole thing into memory when reading from/saving to a HTML5 database will likely crash the app.  (I've already had to write a bunch of Javascript extensions to stream data from the files rather than loading the whole thing).

 

Are there any sort of guidelines for reacting to a BB device which doesn't have a SD Card, (in-fact is there even any way to detect if the user has an SD card and what space is left in WebWorks?)

 

Thanks

 

 

 

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Where to store BlackBerry WebWorks Application Specific Files?

You can use the getFreeSpaceForRoot() function call to find out how much space is left on the SD card or the device memory for storage

 

https://bdsc.webapps.blackberry.com/html5/apis/blackberry.io.dir.html#.getFreeSpaceForRoot

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 24
Registered: ‎10-12-2011
My Device: Lots
My Carrier: All

Re: Where to store BlackBerry WebWorks Application Specific Files?

Thanks again for your reply, I'll check out that method.

 

I was thinking, obviously you've confirmed that there are no WebWorks API methods provided that can access to an application specific file stote but what about using native Java when using a Javascript Extension?

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Where to store BlackBerry WebWorks Application Specific Files?

This is a BlackBerry Smartphone OS limitation.  No different in Java.

 

What some developers have done in Java is used encryption to encrypt the files on the file system.  However, if you do this you won't be able to rely on the built in apps on the device to display the contents of the files.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Highlighted
Contributor
Posts: 24
Registered: ‎10-12-2011
My Device: Lots
My Carrier: All

Re: Where to store BlackBerry WebWorks Application Specific Files?

Thanks for your reply,

 

I am already performing encryption but this doesn't happen until after I've recorded from the microphone (using blackberry.media.microphone).  If something happens during the recording and the encryption then the audio file is available for all and sundry to access.

 

I guess this is just a limitation of the BlackBerry and I will have to make users aware.

 

Thanks again for your help.