"Could not start constructor: ReferenceError: PluginManager not defined" in Android PhoneGap

How to stop the error Failed to run constructor: ReferenceError: PluginManager is not definedin Phonegap in Android?

+5
source share
1 answer

In version 1.0 of PhoneGap, they changed the plugin mechanism.

The old way to add plugins was part of PhoneGap.addConstructorthe javascript file for the plugin.

You will have something like

PhoneGap.addConstructor(function() {
   PhoneGap.addPlugin('analytics', new Analytics());
   PluginManager.addService("GoogleAnalyticsTracker", "com.phonegap.plugins.analytics.GoogleAnalyticsTracker");
});

However, in new versions you are now taking a step addServiceinside the file res/xml/plugins.xml.

, Google Analytics, - . , , , . , , PluginManager.addService(.....) analytics.js.

+8

All Articles