Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin doesn't seem to work #58

Open
vespino opened this issue Mar 18, 2014 · 5 comments
Open

Plugin doesn't seem to work #58

vespino opened this issue Mar 18, 2014 · 5 comments

Comments

@vespino
Copy link

vespino commented Mar 18, 2014

I have tried the following integration (Phonegap Build) but the plugin doesn't seem to work:

In my config.xml:
[gap:plugin name="com.adobe.plugins.gaplugin" /]

In my javascript file:
function onDeviceReady() {
app.initialize();
gaPlugin = window.plugins.gaPlugin;
gaPlugin.init(successHandler, errorHandler, "UA-12345678-1", 10);
}

I have created the success and error functions, but both don't seem to be fired. So no success and no error.

What can I be doing wrong?

@ghost
Copy link

ghost commented Mar 25, 2014

I'm having the same issue. To test it, I created a new app that was just a single page based on the repo's example and it's still not working. When I log the 'result' or 'error' from the success or error callbacks, they are both null.

@dotNetkow
Copy link

Hi - I'm successfully using the plugin and happened across your issue. I think I know the issue - do you have the line of code that registers the onDeviceReady method? I noticed this is missing from the README; it should definitely be added in in order to have a true working example:

function onDeviceReady() {
      gaPlugin = window.plugins.gaPlugin;
      gaPlugin.init(successHandler, errorHandler, "YOUR ID", 10);
}
function initialize() {
      // PhoneGap will call this for you it has fully loaded and is ready for plugin interaction
      document.addEventListener("deviceready", onDeviceReady, false);
}

and then HTML:

<body onload="initialize();">
    // other HTML
</body>

@vespino
Copy link
Author

vespino commented Apr 4, 2014

My problem seem to be "app.initialize();" which had to be at the and of the onDeviceReady function. It works perfectly now!

@ghost
Copy link

ghost commented Apr 4, 2014

My issue turned out to be some conflict with FastClick https://github.com/ftlabs/fastclick

For some reason, it was preventing it from ever calling 'onDeviceReady' so the gaPlugin object was never being created. I removed FastClick and it seemed to work fine and called it good. :)

@dotNetkow
Copy link

Ah, ok. Strange, but I've run across issues like that before. What usually works for me if I introduce something new and see odd behavior, especially with onDeviceReady is to slowly work my way backwards until it's resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants