Start a new topic

Cordova Sample not working

Cordova Sample not working


I'm having troubles getting Wikitdue to work in a Cordova app. I followed the instructions at

I created a new Cordova app, installed the Wikitude plugin from Github, entered the trail license key and added. After that I replaced the index.js of the new Cordova app with the complete code of the example from above link:

var app = {


    // Url/Path to the augmented reality experience you would like to load

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

    // The features your augmented reality experience requires, only define the ones you really need

    requiredFeatures: ,

    // Represents the device capability of launching augmented reality experiences with specific features

    isDeviceSupported: false,

    // Additional startup settings, for now the only setting available is camera_position (back|front)



        "camera_position": "back"


    // Application Constructor

    initialize: function() {



    // Bind Event Listeners


    // Bind any events that are required on startup. Common events are:

    // 'load', 'deviceready', 'offline', and 'online'.

    bindEvents: function() {

        document.addEventListener('deviceready', this.onDeviceReady, false);


    // deviceready Event Handler

    onDeviceReady: function() {

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

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


    // Callback if the device supports all required features

    onDeviceSupported: function() {









    // Callback if the device does not support all required features

    onDeviceNotSupported: function(errorMessage) {



    // Callback if your AR experience loaded successful

    onARExperienceLoadedSuccessful: function(loadedURL) {


        /* Respond to successful augmented reality experience loading if you need to */ 


    // Callback if your AR experience did not load successful

    onARExperienceLoadError: function(errorMessage) {

        alert('Loading AR web view failed: ' + errorMessage);







Then I built and run the app on my device. Everything worked fine and of course onARExperienceLoadError() was invoked, because Wikitude was unable to load the URL. Now I added a world from the provided sample files to my project and entered the correct URL (as you can see in the code above). And this is where the problems begin: Nothing happens. It seems onARExperienceLoadedSuccessful() does not get invoked, since I don't get an error and the alert(loadedURL) I added to the onARExperienceLoadedSuccessful() does not appear as well.


What am I missing here, what am I doing wrong?


When I replace the contents of the www directory with the whole sample app provided, every thing works fine. So I guess the plugin and all is installed correctly.


I would really appreciate, if anybody can help me figure this out. Thanks in advance!

Hi Manuel,
Might it be that your changes are in the wrong www folder? At least on iOS two www directories exist and one is overwritten by the other at build time. Can you post some screenshots of your IDE or a demo project? That makes it probably easier to find the problem.

Best regards,

Login or Signup to post a comment