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
BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: WebWorks BB10 screenshot extension

You're using the wrong version of the extension. The extensions in the BB10 folder are for WebWorks 1.0. You want the ones from the BB10-Cordova folder, which work on WebWorks 2.0, Cordova, and PhoneGap.

 

They install into your application, not the SDK.

 

Here's the Screenshot one: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/Screenshot

Tim Windsor
Open Source Technical Lead
New Contributor
elvishew
Posts: 4
Registered: ‎11-02-2012
My Device: PlayBook

Re: WebWorks BB10 screenshot extension

@twindsor Thank you so much, the fact is as what you said, it works.
New Contributor
Rajeevach
Posts: 8
Registered: ‎11-18-2014
My Device: BB Z10

Re: WebWorks BB10 screenshot extension

HI,

I have followed the steps mentioned but i am getting the error " Uncaught ReferenceError: net is not definedindex.html:35 document.getElementById.onclick" in my console. 

Plz help me in this, i am new to BB App development.

 

Thanks

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: WebWorks BB10 screenshot extension

Did you build your application with WebWorks 1.0 or 2.x?

 

What steps did you follow to add the plugin to your application?

 

You are seeing this error in the WebInspector console on your app, which is running on your device?

Tim Windsor
Open Source Technical Lead
New Contributor
Rajeevach
Posts: 8
Registered: ‎11-18-2014
My Device: BB Z10

Re: WebWorks BB10 screenshot extension

[ Edited ]

Thanks for the reply.

 

I am using WebWorks 1.0. The steps which is mentioned in the github.

 

1. Install the extension into your BB10 WebWorks SDK by copying the net.jonwebb.screenshot folder from the ext folder to the Framework/ext folder in your WebWorks SDK (On Windows normallyC:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK (version#)\Framework\Ext).

2. Edit the config.xml in your project and add the following feature tag:

        "<feature id="net.jonwebb.screenshot" />"

3. Added html :  "<img id="myimage" />"

4. Added js code .js : 

       // configure option

          var options = {dest:'data&colon;', mime:'image/png'};

      // perform screenshot

        var screenshot = net.jonwebb.screenshot.execute(options);

     // check result

        if(screenshot.substr(0,5)=="data&colon;")

             $('#myimage').attr('src', screenshot);

        else

             alert(screenshot);

 

It is showing the error in console that 

    Uncaught ReferenceError: net is not defined

 

i trying this on ripple emulator in chrome. Please mention the steps to include this plugin and steps to call the screenshot functionality on click of a button.

 

Plz Help me on this

Thanks

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: WebWorks BB10 screenshot extension

Extensions aren't supported in Ripple. You will need to build for the device and test it on there to see if it works. The simulator will work for many of the extensions as well.

Tim Windsor
Open Source Technical Lead
New Contributor
Rajeevach
Posts: 8
Registered: ‎11-18-2014
My Device: BB Z10

Re: WebWorks BB10 screenshot extension

Thank you for reply. i'll test it on the device.

New Contributor
Rajeevach
Posts: 8
Registered: ‎11-18-2014
My Device: BB Z10

Re: WebWorks BB10 screenshot extension

[ Edited ]

Hi I have added the plugin to my app and deployed it on my device. But wen i am trying to call the functionality in my code it is showing the error called "Error Can't  find object for id execute" in alert box(in the device).

 

here is my function which i am calling onclick of a button :

------------------------------------------------

function takescreen(){
   // configure options
    var options = {dest:'data&colon;', mime:'image/png'};
    // perform screenshot
    var screenshot = community.screenshot.execute(options);
    // check result
    if(screenshot.substr(0,5)=="data&colon;"){
        $('#myimage').attr('src', screenshot);
    }
    else {
        alert(screenshot);
    }
   }

---------------------------------------------

Please help on this

Thanks,

Rajeev

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: WebWorks BB10 screenshot extension

[ Edited ]

The WebWorks 1.0 extension is accessed through 

net.jonwebb.screenshot.execute(options);

You said before that you were using WebWorks 1.0, and that should be using the extension here: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10/Screenshot

 

However, if you are using WebWorks 2.x now, then you need to use the Cordova Plugin from here: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/Screenshot, or just use the version that was migrated into the SDK itself: https://developer.blackberry.com/html5/apis/v2_2/blackberry.screenshot.html

 

It's very important to stick with one SDK or the other and since you've started saying "plugin" and referring to the function call:

community.screenshot.execute(options);

It seems like you may have switched, or are starting to integrate things from different SDKs. Using WebInspector, do you have a community.screenshot object? Do you also have a net.jonwebb.screenshot?

Tim Windsor
Open Source Technical Lead