Start a new topic

callJavaScript Problem

callJavaScript Problem

In the phonegap JS


    onScreenCaptured: function (absoluteFilePath) {

app.wikitudePlugin.callJavaScript( "World.screencap('"+absoluteFilePath+"');");

//        alert("snapshot stored at:n" + absoluteFilePath);



In the world

var World = {  

screencap: function screenCapFn(filepath) {

alert("path : " + filepath);



The screencap function doesn't fired. Is there anything wrong I made?



Hi Frederick!
I just did a quick test to see if there is anything wrong with your code.
In my PhoneGap's index.js, I called the 'callJavaScript' function with a fake file filePath.

var filePath = "foo/bar/baz.png";

app.wikitudePlugin.callJavaScript("showFilePath('" + filePath + "');");


In my ARchitect World, I added a function which simply alerts a given string.

function showFilePath(filePath)





For me, everything was working, so it might be a problem with your absoluteFilePath variable? Did you alert this one as well?
You can use Safaris Web Inspector to debug your PhoneGap & ARchitect Worlds javascript part. We have a short section about how to use Web Inspector in our documentation and you can also find more details in the web.


Best regards


I alert the absoluteFilePath in the "onScreenCaptured" function, it is ok. Just it doesn't have any alert in the world.

Is there only way I can return back the file path of the screen capture with callJavascript? I want to return back the saved filepath back to the World, and display on the screen.

You can return the file path back into the ARchtiect World using the 'callJavaScript' function. There is simply either a typo or a similar problem which is aborthing the function call. Using Web Inspector and a little bit of debugging, you will be able to pass the value back into the ARchitect World.

Best regards


I found out that, when I call the callJavaScript, there is an error in the log. "exec() call to unknown plugin: wikitudePlugin"

However, there is no problem when I call others such as hide and show.

In WititudePlugin.js, this line "cordova.exec(this.onWikitudeOK, this.onWikitudeError, "wikitudePlugin", "callJavascript", );" runs, but the result is going to "this.onWikitudeError" function.

I am using Phonegap (Cordova) 3.4, is it a problem when running with 3.4?



I found out what happened. 

cordova.exec(this.onWikitudeOK, this.onWikitudeError, "wikitudePlugin", "callJavascript", );"

The plugin name is not correct.

My source ( is downloaded at 11/2. The plugin name is incorrect.

However, the current source ( is correct.

Spend me a day to solve this problem. T.T
Login or Signup to post a comment