Add custom cordova plugin v2


#1

Hey guys, first post here.

I’m developing an android app, and writing a plugin to take the installation referrer.

My current problem is that i’m unable to use my (basic) plugin in v2.

This is the plugin.xml (from a tutorial):

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
		id="my-cordova-plugin"
		version="1.0.0">
		<name>My Cordova Plugin</name>
		<description></description>
		<license></license>
		<keywords></keywords>

		<js-module src="www/plugin.js" name="plugin">
			<clobbers target="MyCordovaPlugin" />
		</js-module>

		<platform name="android">
			<config-file target="rex/xml/config.xml" parent="/*">
				<feature name="MyCordovaPlugin">
					<param name="android-package" value="com.example.MyCordovaPlugin" />
				</feature>
			</config-file>
			<source-file src="src/android/com/example/MyCordovaPlugin.java" target-dir="src/com/example/" />
		</platform>
</plugin>

and, in app.component i tried using window.plugins, (window).plugins and declare var MyCordovaPlugin : any;

but nothing works. I’m crushing my head into the wall. Can you help me? Thank you.