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
New Contributor
amitanandj
Posts: 2
Registered: ‎02-27-2011
My Device: Not Specified
Accepted Solution

File I/O

Hi,

 

I just started working with the playbook simulator and webworks sdk.

can somebody give me a basic example of how a file is read and written to the file system by a custom app using webworks. 

 

I tried downloading the File I/O example from webworks samples but they don't seem to work as described. When I publish the application to the simulator the Menu options don't show up.

 

Also, any tips on how to debug runtime errors on the simulator would be greatly appreciated.

 

Thanks,

Amit

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

Re: File I/O

Hi Amit,

 

The File IO APIs are not yet available on the PlayBook WebWorks SDK.  We are working on them over the next couple of sprints.

 

The APIs available on the PlayBook are here:

http://www.blackberry.com/developers/docs/webworks/api/playbook/

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
pnewhook
Posts: 70
Registered: ‎01-13-2011
My Device: Torch 9800 and Playbook

Re: File I/O

@tneil, because the simulator doesn't have any basic apps, the Invoke methods don't do anything. Is it possible to put a warning to that effect in the API docs?

New Contributor
amitanandj
Posts: 2
Registered: ‎02-27-2011
My Device: Not Specified

Re: File I/O

The sketchPad example has this snippet of code.

The code presumably takes a snapshot of the screen and saves it to the local filesystem.

So if the File IO API is not released then does this mean that this code (trying to save the file )will not execute.

 

 

function takeScreenshot() {
    try {
        var fileName = "file:///store/home/user/pictures/" + getFileName();
        if (extensions.screenshot.capture(fileName)) {
            alert("Screen image saved:\n" + fileName);
        }
    } catch (e) {
        alert('exception (takeScreenshot): ' + e.name + '; ' + e.message);
    }
}

 

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

Re: File I/O

The sketchPad example is an application that runs both on the BlackBerry Smartphone and PlayBook with one source code base.

 

The takeScreenshot() function will only be called on the BlackBerry Smartphone where this functionality exists.  There will be a flag in the code that will make this available on a Smartphone and not the PlayBook.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter