The function navigateTo is called when a button is pressed from the ARWorld Interface but nothing happens. Despite of that, everything works fine.
How can I use Phonegap functions from my Wikitude project?
Thank you
A
Andreas Schacherbauer
said
about 8 years ago
Hi Alex, As far as I understood the code in code.js is part of your ARchitect World. Although the PhoneGap app and the ARchitect World are coded in JS, both can not directly communicate with each other and also they don't share the same global scope. This means that the navigator from PhoneGap is not available in an ARchitect World and the Safari Web Inspector should throw an error stating the error.
Please make yourself familiar with one of our knowledge base articles which describes the communication between PhoneGap & ARchitect in more detail.
Best regards
Andreas
A
Alex Villanueva
said
about 8 years ago
Hi Andreas,
Yes I know that they don't share the same scope but there must be a way to communicate both codes, thats why I use the architectsdk:// but I don't know if it's only for plugin calls. I've read the whole documentation but I still doesn't know how to do it. In theory, document.location should call the onUrlInvoke function but it doesn't. I suppose there is some way to use phonegap functions from the ARWorld, could someone post any example please? I've searched through all the Internet but I couldn't find a solution.
A
Andreas Schacherbauer
said
about 8 years ago
Hi Alex, You can't use any PhoneGap functions in ARchitect. If you need any information in ARchitect that you can get somehow from PhoneGap, you need to use the onURLInvoked function and the callJavaScript function of our Plugin.
I've copied the essential parts below. With the following snippets and the working sample code in the knowledge base article, you should be able to communicate between both context's.
PhoneGap
To register a callback function inside the PhoneGap context, use the `setOnUrlInvokeCallback` function.
I am able to close wikitude using architectsdk://action=somethinghere but only on Android.
On iOS this doesn't work; is there a setting (e.g. cordova's <meta http-equiv="Content-Security-Policy" content="gap:">) that would help enable the link?
Alex Villanueva