J
J
Jekins D&D2014-08-16 11:57:25
Mobile development
Jekins D&D, 2014-08-16 11:57:25

How to activate screenshot plugin on Phonegap?

Good day.
I recently started developing on phonegap and in the application I conceived, to save the results, you need to take a screenshot of the screen. I searched a lot of resources in search of a solution to this problem and found a plugin for phongap, which makes it possible to take a screenshot at the touch of a button. But there was a problem with understanding how to install it, connect it and bring it into working condition.
The application is conceived for Android and iOS.
Here is the plugin itself: plugins.cordova.io/#/package/com.blackberry.commun...
It seemed to be possible to install it, I did it with the command indicated there:

$ cordova plugin add com.blackberry.community.screenshot

In the project folder on phonegap, in the plugins folder, it appeared. Ok, then, following the instructions in html, I also set
<img id="myimage" />
the button to which I attached the execution of the code indicated there with a click script:
// configure options
    var options = {dest:'data:', mime:'image/png'};
    // perform screenshot
    var screenshot = community.screenshot.execute(options);
    // check result
    if(screenshot.substr(0,5)=="data:")
        $('#myimage').attr('src', screenshot)
    else
        alert(screenshot);

But unfortunately when you click on the button, the screenshot is not taken.
Please help me to figure out what I did wrong and how to solve this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-08-16
Protko @Fesor

The plugin is only for blackberry, don't you notice the catch?
You will have to implement the plugin yourself using Java and Objective-c.
There is a library for Anroid: https://code.google.com/p/android-screenshot-library/
for iOS - stackoverflow.com/questions/2200736/how-to-take-a-...
the phonegap documentation describes how to write plugins. Go ahead.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question