Start a new topic

Calling cordova plugin from AR world

Calling cordova plugin from AR world


I am using a social sharing plugin for cordova. Everything works just fine outside of the context of the AR world view. However, I want to access the plugin from within the AR world view. I know that the callJavaScript() function allows for passing and executing JS from app.js to the World's JS but I am wondering how I can access cordova's plugins from the World's JS. Do I need to use callJavaScript() and pass a reference to the cordova plugin? Any help is much appreciated, thanks!

Hi there!

As you mentioned you have to use urlListener in your PG project to intercept AR-Views "document.location='architectsdk://...'" calls.
To link AR actions with another PG module wou therefore need to first call from AR-View's JS to the PG environment and from there trigger calls to the social sharing tool.
Hint: Ensure to close the AR-View when these actions cause UI changes.

Hope that helps.

Best regards,

Hi Andreas,

Thanks for the reply. I've wired up a URL listener and have everything working properly now. Thanks for the help!

Evening, I'm a beginner in wikitude. i wish to have the social sharing function inside the AR view too. I'm facing the same problem, which the social sharing button is working outside of the AR view.

However I have no idea how i can make it happen inside the AR view. Do you mind to provide me an example how to integrate a social sharing function inside the AR context. 

Appreciate the help in anyform. Thanks.

p.s: plugin that i'm testing (



Please use same approach as mentioned in a previous post (urlListener) in order to exchange information between AR-View and Cordova environment.
That way you can e.g. have a "share" button AR.ImageDrawable which triggers a real share action in another plugin.

Note that AR-View's code is also written in JS but runs in a different context. You need to use document.location = "architectsdk://foo?bar=123" to pass over data from AR to Cordova.

Hope that helps
Login or Signup to post a comment