Phonegap Screenshot plugin in Cordova 2.0.0
Posted
by
ObjectiveJ
on Stack Overflow
See other posts from Stack Overflow
or by ObjectiveJ
Published on 2012-09-14T12:45:49Z
Indexed on
2012/09/14
15:38 UTC
Read the original article
Hit count: 553
I have set up the screenshot plugin from github, located here:
https://github.com/phonegap/phonegap-plugins/tree/master/Android/Screenshot
I set it up as instructed and with 1.8.1 of cordova. It worked and the screenshot was saved to the phone. However it fails with cordova 2.0.0.
Screenshot.java code:
Screenshot.js code:
https://github.com/phonegap/phonegap-plugins/blob/master/Android/Screenshot/www/Screenshot.js
Due to the advice of a very clever man called Simon MacDonald, I removed line 31 and 38 from the JS file shown above.
However when I try to use the screenshot plugin with cordova 2.0.0 I receive these errors:
ERROR: org.json.JSONException: Value undefined of type java.lang.String cannot be converted to JSONArray.
Error: Status=8 Message=JSON error
file:///android_asset/www/cordova-2.0.0.js: Line 938 : Error: Status=8 Message=JSON error
Error: Status=8 Message=JSON error at file:///android_asset_/www/cordova-2.0.0.js:938
line 938 of the cordova.js is:
// If error, then display error
else {
console.log("Error: Status="+v.status+" Message="+v.message);
but im almost certain this is a compatibility error. Does anyone know a fix for this, or even a reason. Im abit lost. Any help is appreciated.
I call the screenshot.js with this code:
function takeScreenShot() {
cordovaRef.exec("Screenshot.saveScreenshot");
}
Any help massively appreciated.
© Stack Overflow or respective owner