Wikitude

How can we help you today?

Passing data from Activity to JS

J

Jacob Kee

started a topic
5 months ago

Hi,

I'm very new to Wikitude API.Just wondering how could I pass my data (from my MainActivity) to Javascript so it could use it to filter the results that it obtained from the database and use it to load the POI accordingly.

Wikitude Support

said
5 months ago

Hello Jacob,

There are a couple of errors in your code. First of all, since the calls are asynchronous in javascript, it could be that you are calling the callJavascript method before the loading of the index.html file is completed. Therefore, I would suggest you move the callJavascript method outside of the onPostCreate (maybe put it in the onArchitect World loaded function). Second of all, make sure that the LadUserFromJsonData is actually a function inside the World, otherwise the line below is wrong