Question

I have tried to add the LiveTile plugin (found here) to my clean Cordova 3.3 project. But I can't seem to get it to work. It works with the instruction from the link but that uses Cordova 2.0.0. I get the following printout when I try to add a new Tile:

        An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
        A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll
        An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
        Unable to cast object of type 'System.Collections.Generic.List`1[System.Object]' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'.
        Failed to deserialize Cordova.Extension.Commands.LiveTiles+LiveTilesOptions with JSON value :: ["System.Collections.Generic.Dictionary`2[System.String,System.Object]","LiveTiles963855178"]
        A first chance exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL
        An exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL but was not handled in user code
        A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll
        An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
        ERROR: Exception in ProcessCommand :: Exception has been thrown by the target of an invocation.
        ERROR: failed to InvokeMethodNamed :: createSecondaryTile on Object :: LiveTiles
        The thread 0xbac has exited with code 259 (0x103).
        Error occurred: Invalid action

Are plugins added differently with this new version of Cordova or is the LiveTile plugin simply not compatible anymore?

Was it helpful?

Solution

This might have been a dumb question, but since the documentation is so poor it is hard to call any question dumb. I have however manage to solve this now, and in the off chance that someone else runs in to the same problem I'll try to explain what I did.

First I found this implementation of the LiveTiles plugin which seemed to be more recent then the one in the question. Instead of creating a new project through Visual Studio I used the CLI.

phonegap create hello com.example.hello HelloWorld

Then I used plugman to install the plugin according to the link above.

plugman install --project . --platform wp8 --plugin com.risingj.cordova.livetiles

Now I looked through my files to see what had happened.

config.xml - some addition

    <?xml version='1.0' encoding='utf-8'?>
    <widget>
        <access origin="*" />
        <feature name="LiveTiles">
            <param name="wp-package" value="LiveTiles" />
        </feature>
    </widget>

a new file was generated: cordova_plugins.js in the www-folder with the following content:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
    {
        "file": "plugins/livetiles.js",
        "id": "com.risingj.cordova.livetiles.livetiles",
        "clobbers": [
            "LiveTiles"
        ]
    }
];
module.exports.metadata = 
// TOP OF METADATA
{
    "com.risingj.cordova.livetiles": "0.1.0"
}
// BOTTOM OF METADATA
});

I added these files to a Cordova Visual Studio-project and it worked! So I guess if a new plugin is added this is what is needed.

OTHER TIPS

You need to do this :

cordova plugin add path/to/your/plugin

It will do all the stuff.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top