cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
265 stars 318 forks source link

promises stay pending on android #155

Closed cutout33 closed 8 years ago

cutout33 commented 8 years ago

Hi,

I wrote a small application using this plugin, it seems to work on iOS but not on android. it does not return the promises value for any of the methods. can someone help me please?

davjand commented 8 years ago

I'm having the same issue but just a thought - do you have google play services enabled on your device?

davjand commented 8 years ago

I think this issue is caused by the plugin being unable to connect to Google Play services.

I've debugged the java code and find that the onConnectionFailed method on AbstractGoogleServiceCommand.java is being called.

It is a bug in the sense that promise should reject in this situation.

A fix might be to ensure that your device or emulator has up to date google play services installed.

Assuming you're using the GenyMotion emulator then this might be helpful: https://inthecheesefactory.com/blog/how-to-install-google-services-on-genymotion/en

cutout33 commented 8 years ago

am testing on real devices, and yes it has google play services enabled. any way to work around this issue??

davjand commented 8 years ago

By using android v5.1 on the genymotion simulator this seems to be working now - I'm pretty confident it is a google play services issue. The error I was getting before was because the google play services were out of date

The easiest way to debug this is to change the third parameter on Line 57 of GeofencePlugin.java to be true. That way it will show toasts of any error messages

cutout33 commented 8 years ago

I enabled the logs, the only msg am getting 'geofence intent created' snd still the promises are pending! no errors, play services is latest and same code is working on iOS! Also I tried this on 4 different android devices!

davjand commented 8 years ago

The only thing I can think of to do is to debug the geofence code in android studio and see where it's messing up. I don't know if you're familiar with it but I found it quite easy for the first time - just open the platforms/android folder after you've done a build and then you can debug from there

On Sun, 10 Jul 2016 at 18:48 cutout33 notifications@github.com wrote:

I enabled the logs, the only msg am getting 'geofence intent created' snd still the promises are pending! no errors, play services is latest and same code is working on iOS!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cowbell/cordova-plugin-geofence/issues/155#issuecomment-231601496, or mute the thread https://github.com/notifications/unsubscribe/AAWtzni1LjeeipnOsVBgZdzKQAUIebFDks5qUTB2gaJpZM4JIm13 .

cutout33 commented 8 years ago

OK, I think it is related to the play services not being up to date but I don't really know how to fix it! this is the error I get in android studio:

The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 8298000 but found 6171000. You must have the following declaration within the element: < meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

the tag is already the file and on the phones I test on the version of google play services is 2.9.56 (it is latest) can you please help me figure this out?

cutout33 commented 8 years ago

I finally figured this out! I had to change the version number inside cordova/plugins/com.google.playservices/version.xml and then remove and add android via cordova...

Thanks for the help