Start a new topic

Android callJavascript

Android callJavascript

I try to pass data to my ArquitectWorld in Javascript, I'm using the method callJavascript("nameFn(param)"); my code:




function MyFn(param) {

//here received the variable from android



var World = {

//here I need to use the variable that I received




I received succesfully the variable, but I can't use it inside World

Hi Sergio,

This is more of an architectural question and/or a JavaScript-related question rather than a question specifically for the Wikitude SDK.

Depending on your program structure and the way you have organized your code, there are lots of ways to achieve what you want. A straight forward (however, not necessarily beautiful and elegant) way is to add the myFn function to your World object, so you have access to all your properties in your World object. Something like:

var World = {

    myFn : function(value){

        // your code here



In your world, you can then call the function using arquitectView.callJavascript("World.myFn(num)");

However, as I said already, this depends heavily on the way you organize your code. A straight forward way is sometimes not the best solution.



Thanks Martin it's working now.

Hi, i have a question, when it is the best moment for use arquitectView.callJavascript on onCreate or  on onPostCreate?

Login or Signup to post a comment