Re: [PhoneGap] Error::Plugin not allowed in config.xml

871 views
Skip to first unread message

Jesse

unread,
May 13, 2013, 3:37:11 PM5/13/13
to phon...@googlegroups.com
Hi Sabine,

There are a few things you will need to change to get your code to work.
1. In the JS call to exec, you should just be calling the Class name, and not the full namespace.
  ex. 
cordova.exec(callback, function (err) {
                        callback('Nothing to echo.');
                    }, "Scheduler", "echo", [str]);

2. Plugins need to be defined in the Cordova namespace to be accessible at runtime ( this will change shortly, btw )  
Changing the namespace of your Scheduler class to 'WPCordovaClassLib.Cordova.Commands' and all is good.

Hope this helps you.

Cheers,
  Jesse


@purplecabbage


On Tue, May 7, 2013 at 7:24 AM, Sabine Rödiger <sabine....@flyingfi.sh> wrote:
Hi there!

I am trying to create a plugin using Cordova 2.7 and C# on Windows Phone 8. I followed the plugin development guide step by step. So currently I have these functions in my index.html:

            function onLoad() {
                document.addEventListener("deviceready", onDeviceReady, false);
            }

            function onDeviceReady() {
                window.echo = function (str, callback) {
                    cordova.exec(callback, function (err) {
                        callback('Nothing to echo.');
                    }, "sh.flyingfi.cordovaExtensions.Scheduler", "echo", [str]);
                };
                window.echo("echome", function (echoValue) {
                    alert(echoValue == "echome");
                });
            }


The scheduler class looks like this:

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

namespace sh.flyingfi.cordovaExtensions
{
    public class Scheduler : BaseCommand
    {
        public void echo(string options)
        {
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "Everything went as planned, this is a result that is passed to the success handler."));

        }
    }
}

Finally I added <plugin name="Scheduler" value="sh.flyingfi.cordovaExtensions.echo"/> to config.xml.
When debugging the output is "Error::Plugin not allowed in config.xml".

I don't understand why. Could anyone help me?

Thanks! :)

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Chris Nickerson

unread,
Sep 10, 2013, 2:09:27 PM9/10/13
to phon...@googlegroups.com
Hi Jesse,

I've been trying to setup a simple Windows Phone 8 plugin similar to Sabine and I am unable to get past the error mentioned even after your changes.  The one difference is I am using the Cordova 3.0 API.  Here are other details about how I've tried to access my HelloWorld plugin.

1) I've included the DLL generated by my project containing my Plugin code as a reference to my Cordova solution.
2) I've tried including the class file (.cs) that extends BaseCommand to the root of my Cordova solution.
3) I've tried following the documentation at (http://docs.phonegap.com/en/3.0.0/guide_platforms_wp8_plugin.md.html#Windows%20Phone%20Plugins) under the Plugin XML section.  However I could not understand this section in the documentation.

The XML that I have for point three looks like:

<?xml version="1.0" encoding="UTF-8"?>
    id="com.example.HelloCordova"
    version="1.0.2">
    <source-file src="Lib/CordovaPlugin.dll" />
    <config-file target="config.xml" parent="/*" >
        <feature name="Echno">
            <param name="wp-package" value="Echno" />
        </feature>
    </config-file>
</plugin>

Any help would be appreciated as this the only thread I've found on WP8 plugins with Cordova.  The other thing I found is a potential bug logged a few days ago (https://issues.apache.org/jira/browse/CB-4722).

Thanks,
Chris

tho...@situve.com

unread,
Oct 1, 2013, 10:59:16 AM10/1/13
to phon...@googlegroups.com
Hello,

Sabine are you solved the problem ?

I have the same and don't fin any example, sample, tuorial or documentation realize a functional call of custom plugin.

I use custom plugins in 2.x version of phonegap and in others plateformes with 3.0 but in this case, i desperate:'( .

Thanks to everyone for help.
Reply all
Reply to author
Forward
0 new messages