JavaForAndroid
JavaForAndroid

Reputation: 1179

Android Location deprecated?

I noticed that Android Location seems to be deprecated. I found in the API reference (https://developer.android.com/reference/android/location/package-summary.html) this: This API is not the recommended method for accessing Android location.

It is quite confusing because there is not information about this in the API of the class Location. And it still works well.

I guess there are some good reasons to stop using the Location class. I would like to know which is the recommended way to locate a user and implement a location-based application. Do I have to change my app to the new way that is linked? I am a little bit disappointed that this remark is only on one page.

Upvotes: 1

Views: 2727

Answers (2)

thenoobtechie
thenoobtechie

Reputation: 161

Yes android LocationApi is deprecated.

FusedLocationProviderApi is also deprecated https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi

Now you should migrate to the new FusedLocationProviderClient -- https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient

Upvotes: 1

Pablo Baxter
Pablo Baxter

Reputation: 2234

It's not necessarily true that android.location isn't supported any longer, since it has actually had some API changes as of Android Oreo (look at the Location class). It's just a "low-level" API for location that is common across all Android devices, but doesn't offer the benefit of power-savings and accuracy that Google's Fused Location Provider does. Underneath it all, Fused Location Provider utilizes android.location, just in an efficient manner.

Unless you really have a need for the granularity of control over location calls and are able to properly manage the power consumption of the calls you make for it, it's recommended to use Fused Location Provider.

Upvotes: 0

Related Questions