Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 292 forks source link

Android now supports new getCurrentLocation API #227

Open ravirajn22 opened 3 years ago

ravirajn22 commented 3 years ago

@Agontuk

getCurrentLocation API now gets fresh GPS location and handles subscription. So may be you can use it in code, instead of handling subscribing for single location request.

https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient#public-tasklocation-getcurrentlocation-int-priority,-cancellationtoken-token

https://android-developers.googleblog.com/2020/12/improving-urban-gps-accuracy-for-your.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+blogspot%2FhsDu+%28Android+Developers+Blog%29

Agontuk commented 3 years ago

Nice finding :), but users need to have at least 17.1.0 google play service version for this to work. Should we force users to update to the newer versions ? Most of the developers face play service version mismatch quite often, so that's a concern.

ravirajn22 commented 3 years ago

Google has moved away from having same google play service version, I think if the google provided getCurrentLocation works more robust, I think its worth the change.

Agontuk commented 3 years ago

I'll try implementing this. I'm currently rewriting the android implementation to add support for android's default location manager api if google play service is not available. You can check here, if you're interested.

ravirajn22 commented 3 years ago

I'll try implementing this. I'm currently rewriting the android implementation to add support for android's default location manager api if google play service is not available. You can check here, if you're interested.

Should help people in china and people who try to avoid using google services for privacy issues. I will try to look on weekends.

yogesch commented 3 years ago

I'll try implementing this. I'm currently rewriting the android implementation to add support for android's default location manager api if google play service is not available. You can check here, if you're interested.

It will be really nice to have the option to use the default location manager since services geolocation seems to act up for some people, even when it is available. And this is about the only decent library that is still being maintained.