ensa
ensa

Reputation: 23

Cordova exec function not defined in cordova-2.1.0

i was trying to implement a push notification plugin in simple example. when i run my app and when i call cordova.exe() from my index.html via index.js i get this error :

Uncaught ReferenceError: Cordova is not defined at file:///android_asset/www/PushPlugin.js

i use cordova-2.1.0.js ! but when i changed it to cordova-3.0.0.js i get this information in the logCat consol :

exec() call to unknown plugin: PushPlugin

that's mean that any "PushPlugin" not declared in res/xml/config.xml file, but i put this line in my config.xml :

    <plugins>
...
      <plugin name="Plugin" value="com.example.Plugin"/> 
...
    </plugins>

so can u help me and gave me some solutions of this kind of problems ?

Upvotes: 2

Views: 3328

Answers (1)

Nomade
Nomade

Reputation: 1748

i got the same error before , and you said that you have changed to cordova-3.0.0 ! so you upgraded your application from cordova-2.1.0.js to cordova-3.0.0 !

so you have to replace this line in the config.xml :

<plugins>
    <plugin name="Plugin" value="com.example.Plugin" />
<plugins>

by :

<feature name="Plugin">
            <param name="android-package" value="com.example.Plugin" />
        </feature>

because you have upgraded the application to cordova-3.0.0, so you have to change the plugin declaration syntax in the res/xml/config.xml

Upvotes: 4

Related Questions