Search code examples
javascriptcordovacordova-pluginsvisual-studio-2015

Visual Studio 2015 RC Cordova Tools - Plugin Fails to Launch


After struggling for several hours with getting Visual Studio 2015 Cordova Tools set up and running, the first plugin I add, Device, fails to launch at onDeviceReady. No error is thrown. It simply does not launch and when I attempt to access one of its properties, then I get a JavaScript undefined exception.

Can anyone point me at a way to get at the cause of a plugin simply not working?


Solution

  • Make sure the below is added on the top of your page:

    <!-- Cordova reference, this is added to your app when it's built. -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>
    <script src="scripts/index.js"></script>
    

    And Make sure the callbck events are added:

        <script>
    
        //Events
        document.addEventListener("deviceready", onDeviceReady, false);
    
        </script>
    

    If it helps, the config file looks like this for the plugin in question:

       <vs:plugin name="org.apache.cordova.device" version="0.2.12" />
    

    FYI - I have found the config designer useless - and have to edit the versions manually before deploying to the app stores (in this case for both win and android). Using VS2013 - to scared of VS2015 RTM. My config broke at some point while adding plugins, and now is half-baked, but working.