简体   繁体   中英

Cordova and Windows Phone, calling cordova.exec

I need some help trying to execute a plugin using the cordova.exec using Phonegap.

I followed the tutorial here: WP plugin tutorial

However When I try to run this I get the following error:

Error::Plugin not allowed in config.xml. Echo

Here is how I am calling it from javascript:

cordova.exec(function(){ console.log("success");}, function(){console.log("fail");}, "Echo", "echo", ["input string"]);

here is my Echo.cs

using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;

namespace Cordova.Extension.Commands
{
    public class Echo : BaseCommand
    {
        public void echo(string options)
        {
          string optVal = JsonHelper.Deserialize<string[]>(options)[0];

          DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Everything went as planned, this is a result that is passed to the success handler."));
        }
    }
}

just add to config.xml

<feature name="Echo">
    <param name="wp-package" value="Echo" />
</feature>

the plugin name="Echo" is deprecated and doesn't work anymore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM