mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Check for Network Provider as well, tidy up getLKL()
This commit is contained in:
parent
94b5482495
commit
b7cd435a58
1 changed files with 4 additions and 3 deletions
|
|
@ -81,10 +81,11 @@ public class LocationServiceManager implements LocationListener {
|
|||
|
||||
public LatLng getLKL() {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
//TODO: Check for network provider as well?
|
||||
Location lastKL = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
LatLng lastLatLng = LatLng.from(lastKL);
|
||||
return lastLatLng;
|
||||
if (lastKL == null) {
|
||||
lastKL = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
}
|
||||
return LatLng.from(lastKL);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue