UnifiedNlp icon indicating copy to clipboard operation
UnifiedNlp copied to clipboard

play vs. location services

Open herrdeh opened this issue 9 years ago • 11 comments

I noticed that quite some apps are picky. They are not happy with the (gapps-free) location service provided on my phone, but explicitly want "google play services". An example is the German Mail app, but some more as well.

What can I do?

Is it misconfiguration at my phone? Is it sloppy programming - and should app providers be blamed for that? Or should / could UnifiedNlp be extended by a component which pretends "I'm google play location services" ?

herrdeh avatar Mar 26 '15 17:03 herrdeh

Currently, Google Android has two APIs for geolocating. One of them being the open source Location API that is implemented by UnifiedNLP, the other one is the proprietary Play Services Location API.

Google marked the older open source API as "not recommended" (that does not mean deprecated) and asks developers to use the Play Services API, reasoning "It offers [A] a simpler API, [B] higher accuracy, [C] low-power geofencing, and [D] more." This claim is mostly not backed by facts: A: The API is not really different (compare [play](http://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates%28com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationListener, android.os.Looper%29) vs. [aosp](http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper%29)). B: The play services API does not provide higher accuracy, on Google Android, both do exactly the same since Android 4.2 and are only slightly different on Android 2.3-4.1, the only difference is that play services allows to use automatic merging of locations from multiple sources (GPS and network) on Android 2.2, while open APIs do not. C: The Geofencing API is a revamped version of the older proximity API (detect if a user is "near" a certain location) that is still part of the open source location API. It does not provide additional features. D: The Play Services API can detect whether the user is walking, biking or riding and report this to the app. There is no equivalent to this in the open APIs

Most interestingly, the API changes A and C were originally developed in July 2012 and intended to be published as open APIs of Android, however Google decided against this and disabled the APIs in the source code end of October 2012 - two weeks before release of Android 4.2 and a month after the first release of play services.

As most apps will only use the basic APIs from A that did not change a lot, developers really should use the older APIs as this will add support for non-Google Android-compatible systems (AOSP, Amazon, Nokia, Sailfish OS, ...) without losing support on Google Android. In many cases using the open APIs will also reduce the download size of the app.

If you can contact the developer of the app, you can ask him if it would be possible for him to use open APIs, feel free to send him a link to this post. I am also willing to support every developer with the transition from Play Services APIs to open APIs

Finally I am working on a solution to this problem that does not require changing the app and is being developed as part of the Play Services implementation GmsCore that might see its first release in April (but unfortunately will require either Xposed or a system patch)

mar-v-in avatar Mar 26 '15 22:03 mar-v-in

Thank you so much for this detailed and highly competent answer. I guess it might be quite futile trying to change the ideas of big players such as Deutsche Post etc. And we are completely out of the game when an app no longer is under active development.

So I'm looking forward to GmsCore, I guess that's the most interesting approach.

Anyway: I think you should put this really interesting article into the wiki or a easier-to-find place, I guess more people than just me will interested in it.

herrdeh avatar Mar 30 '15 08:03 herrdeh

mar-v-in Please advise me, as I am developing a gps based android app for school buses, in which parents can see the current position of the school buses. At Bus driver end, the longitude and latitudes coordinates will be taken through gps using android phone. These coordinates will be sent to web server. At parents end, they can see the current position of bus through google maps using the app. As web server will sent the coordinates to parent's end app. Please advise me what will be better for me, either I shoud use open source Location API or Play Services Location API. Thanks

OzairAshfaque avatar May 05 '15 21:05 OzairAshfaque

If you use GPS, there is never an improvement of using the Play Services Location API, the GPS signal will not change its result or accuracy due to Google being the one asking for it.

In your case @OzairAshfaque, there is not a single reason to not use the open source Location APIs, and as using them will even improve performance and reduce you application size, I'd clearly suggest using the open source API.

mar-v-in avatar May 05 '15 21:05 mar-v-in

@mar-v-in thanks a lot for your answer its really helpful. But creating and monitoring Geofences is also needed, as the driver enters in specific geofence location parents will be informed via notification. So please guide me.

OzairAshfaque avatar May 05 '15 22:05 OzairAshfaque

Geofences are called "proximity alerts" in the open source API, see [LocationManager.addProximityAlert(double, double, float, long, PendingIntent)](http://developer.android.com/reference/android/location/LocationManager.html#addProximityAlert%28double, double, float, long, android.app.PendingIntent%29). I did not use proximity alerts yet (nor did I use Geofences), but it should work without problems, as requests to Google's APIs are "redirected" to the platform API.

mar-v-in avatar May 05 '15 22:05 mar-v-in

@mar-v-in Thanks a lot.

OzairAshfaque avatar May 05 '15 22:05 OzairAshfaque

We could really do with guide to supporting non-gms flavors, for NLP, maps and other APIs. I'm often asking devs to visit this issue but often need to address more than just NLP.

dalb8 avatar Jun 12 '15 13:06 dalb8

In the meanwhile, I wrote to several app suppliers and asked for a switch from Play Services Location API to open source Location API. I had problems with the bigger players, such as Deutsche Post or Deutsche Bahn.

None of them even replied to my request, not to talk about announcing a change. We may have to face the fact, that big players are not interested in that change. Therefore, GmsCore might be the way to go.

Anyway - I dont want to have play services back. Tried it recently for a few hours - and it felt as if my phone had the handbrake locked.

W

herrdeh avatar Jun 18 '15 09:06 herrdeh

@mar-v-in Please guide me generally, What will be i needed in making GPS Based Application, how to send coordinates of one user to a website and to the other users as position sharing. Thanks

OzairAshfaque avatar Sep 02 '15 00:09 OzairAshfaque

@mar-v-in I am new in Android development, but I am really confused, I know how to get coordinates and etc but please need a guidance.

OzairAshfaque avatar Sep 02 '15 00:09 OzairAshfaque