keldar
keldar

Reputation: 6252

PhoneGap 3.x/Windows Phone 8 - all plugins are undefined

We are in the process of moving our project away from the old version of PhoneGap. We were using (2.5.0) and now moving to the most recent, up-to-date PhoneGap (3.1).

The app is running well on Android and iOS but, whereas before it was working on Windows Phone 8, now it is not. I have tried debugging what the cause is, and 'deviceready' is fired, but all my plugins are undefined, despite them being listed when I do:

phonegap plugins ls

Yet I cannot work out for the life of me why. If it helps, the config.xml file is as follows:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.mycompany.myapp" version="0.0.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <access origin="*" />
    <feature name="Battery">
        <param name="wp-package" value="Battery" />
    </feature>
    <feature name="Camera">
        <param name="wp-package" value="Camera" />
    </feature>
    <feature name="Console">
        <param name="wp-package" value="DebugConsole" />
    </feature>
    <feature name="Device">
        <param name="wp-package" value="Device" />
    </feature>
    <feature name="Notification">
        <param name="wp-package" value="Notification" />
    </feature>
    <feature name="File">
        <param name="wp-package" value="File" />
    </feature>
    <feature name="FileTransfer">
        <param name="wp-package" value="FileTransfer" />
    </feature>
    <feature name="InAppBrowser">
        <param name="wp-package" value="InAppBrowser" />
    </feature>
    <feature name="NetworkStatus">
        <param name="wp-package" value="NetworkStatus" />
    </feature>
    <name>MyApp</name>
    <description>
        My app
    </description>
    <author email="[email protected]" href="http://cordova.io">
        My Company
    </author>
    <content src="index.html" />
    <preference name="fullscreen" value="false" />
    <preference name="webviewbounce" value="false" />
</widget>

Upvotes: 2

Views: 1030

Answers (3)

gctpoy
gctpoy

Reputation: 91

I am working on cordova 3.3 windows phone 8 application. The cordova plugins that i use are not accessible via navigator.plugins.pluginname.method. Instead they work when calling cordova.exec directly and they are able to access the native functionality

Does anybody else have a problem with plugins in windows phone platform?

Upvotes: 1

Vit
Vit

Reputation: 1

JosephT is right. Also my device plugin was wrongly installed. "cordova run android" fixes it.

I have cordova 3.3.1-0.1.2 and I am developing for Android.

What I did: new project with cordova add plugins with cordova add platform with cordova open project in Eclipse, start make the deployment to device by Eclipse One plugin (not from cordova) was working, but still I got "device is not defined“, when I listed my plugins in CLI, device was installed, but somehow not working.

When used in CLI "cordova run android", probably Android platform part of project was re-created by CLI better than by Eclipse and device plugin start working.

Attention! When you will run "cordova run android" from CLI, code which you created in Eclipse will be overwritten by default from www folder in top of project. Make backup of project and try it, you will see what happen.

Upvotes: 0

JosephT
JosephT

Reputation: 865

I am using phonegap 3.3 and find that the same issue too. undefined plugin

However I try install the plugin first, then run the "phonegap run android" to generate the project. the plugin is working fine. cordova_plugins.js is modified with the plugin installed.

Upvotes: 1

Related Questions