Вопрос

In my PhoneGap + Wikitude app, I have PhoneGap's standard index.html and index.js files which launch my Wikitude world myWorld.html.

In myWorld.html, I need the fileSystem and a FileTransfer. I have put a correct reference to the PhoneGap JavaScript file in myWorld.html.

<script type="text/javascript" src="../../../www/cordova-2.5.0.js"></script>enter image description here

I am trying these two calls without any luck:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fsSuccess, fsFail);

var ft = new FileTransfer();

I am aware of WikitudePlugin.callJavascript() (see this question as well) to call Javascript in the Wikitude world from within PhoneGap but:

  • I understand that using callJavascript(), I can only pass textual parameters to my Wikitude world.
  • Surely there MUST be a way to call PhoneGap functionality from within a Wikitude world HTML as cordova.js is nothing but a JavaScript file?

How can I obtain a reference to the fileSystem and a FileTransfer object in my Wikitude world?

Это было полезно?

Решение

Unfortunately PhoneGap is more than just a JS-file and exentds the JS featureset with native platform features. Usually phonegap plugins are reduced to very simple operations, such as sending an SMS e.g. The Wikitude plugin uses sensors and even analyses cam-frames to apply ImageRecognition algorithms.

Although Wikitude's ARchitect technology also uses JS/HTML that does not mean you can combine them that easy. The AR-View runs in a completely different context and is a View on top of phoneGap's main Activity. Sole way to exchange data between cordova and Wikitude is using the "document.location = architectsdk://..." and architectView.callJavascript.

I recommend you to handle any file-readings in your Cordova environment and pass over all data to Wikitude's SDK using callJavaScript(EgAnyJSONObject).

Hope that helps.

Kind regards, Andreas

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top