Start a new topic

Communication between Android code and Wikitude JS

Communication between Android code and Wikitude JS

Problem statement:

I'm calculating my POI's geographical position (lat and long) in my Android game, and I need to pass this calculated data to my wikitude JS code somehow (where I'm populating the POI object) .

I can't do the calculation in the JS because the calculation relies on some libraries linked to my Android project. 

Is there some kind of parameter passing system, where I can pass extra parameters via some object?

Hi there!

You may use urlListener to intercept JS calls in your native environment (compare POI detail page Samples).
To pass back the calculated values from native to JS use "architectView.callJavascript('onValuesCalculated(12.3456)')" to e.g. execute globally accessible "onValuesCalculated" JS function.

Hope that helps.

Kind regards,

Thanks Andreas!

I ended up using a personal server to store my calculated values, and then used the Webservice to fetch the POIs. Kind a roundabout method.

I'll try the solution you've given.

Thanks Andreas, your solution worked perfectly for me!
Login or Signup to post a comment