Start a new topic

Pass parameters to loadARchitectWorld

Pass parameters to loadARchitectWorld
1 Comment


Hello, I'm using cordova plugin wikitude and I have a problem: I want to download a .wtc file and save in memory of device and after pass the path of this one for initialize AR.ClientTracker. For download the file .wtc I'm using another plugin (cordova plugin file transfer) and it works very well. Now this plugin return the path of the file that is difference beetwen Android and iOs. My goal is pass this path to plugin wikitude in inizialization. This is the code that I use for download a file:

var fileTransfer = new FileTransfer();

var uri = encodeURI("http://some.server.com/download.php");

var fileURL = "cdvfile://localhost/persistent/myFolder/tracker.wtc"

 

fileTransfer.download(

    uri,

    fileURL,

    function(entry) {

        console.log("download complete: " + entry.toURL());

    },

    function(error) {

        console.log("download error source " + error.source);

        console.log("download error target " + error.target);

        console.log("upload error code" + error.code);

    },

    false,

    {

        headers: {

            "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="

        }

    }

);

 

Now I want to pass the value return from object entry (entry.toURL()), to wikitude plugin. Is there a way? Can I pass this value when I load the loadARchitectWorld? This is a snippet:

var app = {

 

    requiredFeatures: ,

    arExperienceUrl: "www/experience/index.html",

    isDeviceSupported: false,

    startupConfiguration: 

    {

        "camera_position": "back"

    },

 

    onDeviceReady: function() {

        app.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");

        app.wikitudePlugin.isDeviceSupported(app.onDeviceSupported, app.onDeviceNotSupported, app.requiredFeatures);

    },

    onDeviceSupported: function() {

        app.wikitudePlugin.loadARchitectWorld(

            app.onARExperienceLoadedSuccessful, 

            app.onARExperienceLoadError,

            app.arExperienceUrl,

            app.requiredFeatures,

            app.startupConfiguration

        );

    },

 

    onARExperienceLoadedSuccessful: function(loadedURL) {

       

    },

    onARExperienceLoadError: function(errorMessage) {

        

    }

 

}

 

Can I insert this path in startupConfiguration and get it after when the world is initialized? If you have other ideas are wekk-accepted. Thanks.

 
Login or Signup to post a comment