LightBlog

jeudi 15 juin 2017

Google Play Services v11 Adds New LocationServices APIs

Earlier this month, Google released version 11 of Google Play Services and it came with a lot of changes to the platform. This update touched on ads, app invites, awareness, identity, casting and so much more. Be sure to check out the full release notes if you are interested in all of the changes that happened. A big change that came with the Google Play Services SDK was the addition of some new APIs for developers who wish to access LocationServices.

Some people use GoogleApiClient for these type of tasks, but Google recently talked about how using the new location APIs can actually reduce friction on your end. The new LocationServices APIs have been put in place to allow developers to access device location, the ability to setup geofences, they can prompt the user to enable location on the device and so much more. Google believes the new location APIs offer a better developer experience because they are simpler and the code is less error-prone.

Not only that, but the connection logic of the new APIs are handled automatically and you as the developer only need to attach a single completion listener. The calls to the API will automatically wait for the service connection so that means you don’t need to wait for onConnected before you start making requests. The new LocationServices APIs use the Task API, which is good because it makes it easier to compose asynchronous operations.

The new APIs will even automatically resolve certain connection failures as well. This means you will not need to implement code that prompts the user to update Google Play Services. There is a lot of interesting work going on here that should make the work of the developer much easier. Google recommends that you check out the updated location samples on GitHub right here.

Source: Android Developers Blog



from xda-developers http://ift.tt/2tqB9IR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire