Skip to content

Commit

Permalink
Get location from best provider
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwedgbury committed May 25, 2018
1 parent 1ae2bc6 commit 82eb9ff
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ public class DeviceLocation implements LocationListener {

public DeviceLocation(LocationScene locationScene) {
this.locationScene = locationScene;
requestLocationUpdates();
}


private void requestLocationUpdates() {
try {
// Getting LocationManager object
locationManager = (LocationManager) locationScene.mContext.getSystemService(Context.LOCATION_SERVICE);
Expand Down Expand Up @@ -110,11 +114,13 @@ private boolean isSameProvider(String provider1, String provider2) {
public void onLocationChanged(Location location) {
if (isBetterLocation(location)) {
currentBestLocation = location;
requestLocationUpdates();
}
}

@Override
public void onProviderDisabled(String provider) {
requestLocationUpdates();
}

@Override
Expand Down

0 comments on commit 82eb9ff

Please sign in to comment.