I noticed that it's possible to request location updates in (at least) two different ways.
Using
GoogleAPIClient
:// Callback for when the GoogleAPIClient is connected @Override public void onConnected(Bundle connectionHint) { LocationServices.FusedLocationApi.requestLocationUpdates( mGoogleApiClient, mLocationRequest, this); }
Using
LocationManager
:LocationManager locationManager = (LocationManager) getActivity(). getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
Google seems to promote method 1
in their tutorial "Receiving Location Updates". It's unclear to me what the benefit of method 1
is, because method 2
is working just as fine for me (I'm using both methods in two different places in an app).