Closed cvaliere closed 8 years ago
Hum, can you share your cordova and android platform version?
Do you use other android plugins?
Version 1.2.0 seems to work. The last version 2.0.0 add support for Android M and has not been thoroughly tested.
cordova 5.4.1 cordova-android 5.0.0 (i have been forced to specify 5.0.0 because the plugin requires it)
i'm using other plugins, including phonegap-plugin-push which uses play services too
ok, with my latest tests, version 1.2.0 works i guess it's the fact to force android@5.0.0 that makes everything broken
could you do something for your version 2 ? I appreciate your work, but it's not cool to release a version that totally doesn't work...
First of all sorry about the broken 2.0.0
release. I wanted to publish the version with Android M support as soon as possible.
I have published a 2.0.1
version with your fix for watch/clearPosition.
I have also updated the README regarding the version to use depending on the Cordova Android platform version.
The test app I use is now on github.
With cordova@5.4.1
, android@5.0.0
and plugin-locationservices@2.0.1
auto and manual tests pass.
Let me know if this release is working in your particular case.
thank you @louisbl, I'll give it another try this week, maybe I had something else broken
the thing is, I also use the googlemaps plugin and they also released a broken version recently, so when I updated my plugins, I was like 'wow, everything is broken, what happens ?', but now it's ok :)
I think I can close this issue now?
yes, I think it works now, sorry for not updating I have a naive question though: what is the goal of this plugin compared to the official cordova-geolocation-plugin? (you should maybe put the answer into the README)
thanks
I've updated the README:
This plugin exists mainly because the cordova geolocation plugin does not use Android code anymore : https://issues.apache.org/jira/browse/CB-5977. It relies on the geolocation capability of the WebView. Depending on your particular needs, this plugin may be more suitable.
yes, I knew that, but does your implementation work better than the Webview API? (more accurate, less battery, works better indoor, ...) I'm asking that because I feel that everyone uses the official plugin (214 stars), and I'm one of the few who use yours. I know that, 18 months ago, when I started using your plugin, it worked really better than the official one (on some Android devices, your plugin was able to fix a position in less than 1 second, when the official plugin would take more than 1 minute). But is it still true now? Sorry for bothering you :)
Well I think it depends :)
On Android 4.4, the webview is based on Chromium and since Android 5 it's a separate APK that is updated as needed, see WebView for Android. On these devices the Geolocation API works quite well for most case.
On older devices, the webview is more or less always outdated and the geolocation API is a lot less reliable. On certain devices you only have access to the GPS through this API, hence the slowness.
Using the Google Play service location API means you rely on the same API not matters the device. You have access to all source of informations (GPS, WiFi, cell tower,...) to get a fix, with a high level API FusedLocationProviderApi
grouping everything.
Also these informations are shared by all apps using the Google Play services locations APIs, so if an app trigger a location update, you will also get the information.
So for now I'd rather use the Google Play services location API has it's better in most case. The official plugin has the advantage of not depending on a proprietary API that's not present on all Android device.
The Play Services also have support for Activity Recognition and Geofencing. It's not implemented yet in this plugin but I want to. You can check this fork for Activity recognition.
Thank you very much, it's much clearer for me now :) Last question, I promise: if we use Crosswalk, does the Geolocation API works well also on old devices? Does it also use all sources of informations (GPS, WiFi, cell tower,...) to get a fix?
Thank you again for your time
Good question! I know they've added support for geolocation API not so long ago, but don't know how. I'll definitively dig that, will keep you up to date :)
well, Crosswalk is just a Chromium embedded into the app, so it should have the same APIs as Android 4.4 and upper The more I think about it, the more I'm convinced that using Google Play Services is useful only if, for some reason, you don't want to use Crosswalk (and I would be very interested in why, because Crosswalk seems totally essential to me)
As for me the final APK size is the main reason not to use Xwalk for some project.
About geolocation in Crosswalk, it wasn't working because of permission problem, but this bug was fixed 2 years ago.
Indeed it uses the Chromium location provider. I'm not sure of the exact behavior depending on the accuracy your request but I think it uses the FusionEngine which use the best of Network and GPS for high accuracy and Network for low accuracy.
OK, thanks again, I have all my answers now :) FYI if you don't know already, it is possible to put several APKs in the PlayStore for the same app, so you can have an APK targeting Android 4.4 and upper without Crosswalk, and another APK for 4.3 and older with Crosswalk.
Maybe I can give my two cents on this discussion.
The project I am using this plugin is a cordova application wrapping an offline location acquisition webapp. In order to get sub-meter accuracy we are using a bluetooth GPS device (Trimble R1) which uses an native application called "GNSS Status" to connect to this bluetooth GPS device. The received GPS data is then forwarded to a correction webservice ("NTRIP") which post-processes the GPS data and returns a more accurate position. This position is the mocked via the android "Mock Location" system feature.
Initially we liked to keep the application running in the Chrome Browser with HTML5 AppCache to facilitate offline functionality. Obviously no browser on Android was able to use this mocked GPS location as an input for the HTML5 geolocation API.
The only way to read this mocked location GPS data was this cordova-plugin. I think it is because this plugin uses Google Play Services which can also access mocked location sources.
7 days ago, I finally removed your plugin, because it appeared to me that, with Crosswalk, I didn't need it.
Then I started to see that my app was slower to make a geolocation fix.
Finally I did some tests today, and... it appears that, even with Crosswalk, your plugin is both faster and more accurate than the HTML5 Geolocation API:
So, I will re-add your plugin! Seems to me like the best available option!
What remains a mystery to me is why nobody uses your plugin... :)
I know that it used to work, because I've been using it for a couple of months. But today, impossible to make it work, and I have no idea why. For getPosition for instance, I can debug until
And then... nothing. win is never called, nor errorCallback
I even tried to come back to a previous version, and still nothing. I totally don't understand, and I don't know what to do.
Is there something special I need to have in my config.xml, or something like that ?