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
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

state of PlayBook file read/write

Hello,

 

I am quite confused about the state of the PlayBook's Webworks file read/write capabilities. I understand that in the 2.1 SDK that file I/O was not supported. However, we are on the 2.2 SDK now and the API documentation web pages indicate that file I/O is now supported. (https://bdsc.webapps.blackberry.com/html5/apis/blackberry.io.file.html)

 

I read another documentation page that indicates that an app can only access files within its own "sandbox". This page seems to imply that if the app is deleted, any files I create within that sandbox will be deleted as well. Ultimately, I am looking to export data to a file that will persist even when my app is deleted. Is this possible using the current WebWorks SDK?

 

I have tried the following code, but am getting an "Error: Error #3001" console error.

 

        if (blackberry.io.dir.exists("file:///accounts/1000/shared/BBTasks") == false)
        {
            blackberry.io.dir.createNewDir("file:///accounts/1000/shared/BBTasks/");
        }; // end if

 

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

Re: state of PlayBook file read/write

I also found this page explaning some of the "sandboxing" that occurs with the file system when using the native SDK. However, I'm still at a loss of how to replicate this functionality using WebWorks.

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/BlackBerry-PlayBook-File-System-L...

 

Any assistance would be appreciated.

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

Re: state of PlayBook file read/write

Just to note that I have included in my config.xml what I think to be the necessary permissions request. However, I'm still getting the same #3001 error message.

 

...
  <feature id="blackberry.message"/>
  <feature id="blackberry.identity"/>
  <feature id="blackberry.find"/>
  <rim:permit>access_shared</rim:permit>
</widget>

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

Re: state of PlayBook file read/write

OK, making some headway here. My first problem is I didn't have the syntax for the permissions in config.xml correct. Here's a version I think should work now:

 

  <feature id="blackberry.message"/>
  <feature id="blackberry.identity"/>
  <feature id="blackberry.find"/>
  <rim:permissions>
    <rim:permit>access_shared</rim:permit>
  </rim:permissions> 
</widget>

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

Re: state of PlayBook file read/write

My next problem was my file path syntax. Apparently the file path syntax used on the smartphone ("file:///accounts/1000/shared/BBTasks") has changed to something like "/accounts/1000/shared/BBTasks" on the tablet.

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
squished18
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800

Re: state of PlayBook file read/write

The third problem I had appears to be security rights. I was trying to create a new folder in "/accounts/1000/shared/". However, it appears if I want to create a new folder it has to be within "/accounts/1000/shared/documents".

 

My code seems to be executing now, but I have still to test if my files are persisting across app delete/re-installs.

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.