This project has moved and is read-only. For the latest updates, please go here.

Using in Cordova App

Dec 23, 2015 at 5:51 PM
Edited Dec 23, 2015 at 7:37 PM
Hi,
First thanks for this great library - I have been using it with great success in my windows 8 app!
I am trying to build a Cordova app and using this library as a plugin.
(would be great to add this feature as there isn't a good windows Cordova plugin for analytics available)
Anyhow,
to do so I copied the winmd file to a folder ex. (c:\plugins\google-analytics\src\*.winmd)
and added the file: plugin.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
           id="google-analytics"
        xmlns:android="http://schemas.android.com/apk/res/android"
        version="1.3">
  <name>GoogleAnalytics</name>
  <platform name="windows">
    <framework src="src/GoogleAnalytics.winmd" custom="true"/>
  </platform>
</plugin>
as per some blog post I read...

The plugin is created and added successfully.

The issue is when I try to execute:
new GoogleAnalytics.EasyTrackerConfig()

I am getting the error:
"Class not registered"

Any idea how to fix that?
Any idea / plans on distributing this SDK as a Cordova plugin?

Thanks!
M
Dec 23, 2015 at 9:32 PM
Solved it for now.
To those who are trying to solve the same problem,
there is a fairly undocumented tag in plugin.xml called 'lib-file'.
this is how I used it:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
           id="google-analytics"
        xmlns:android="http://schemas.android.com/apk/res/android"
        version="1.3">
  <name>Google Analytics</name>

  <platform name="windows">
    <lib-file target="windows" Include="Microsoft.VCLibs, Version=14.0"/>
    <lib-file target="windows" Include="GoogleAnalytics.Native.SDK.Win10, Version=1.3"/>
  </platform>
</plugin>
So after installing the SDK this seem to solve my problem.
would love to see this SDK wrapped as a cordova plugin and added to the crodova site.

Thx!
M