場所の更新を(少なくとも)2つの異なる方法でリクエストできることに気づきました。GoogleAPIClientを使用してロケーションの更新をリクエストする理由
GoogleAPIClient
を使用
:
// Callback for when the GoogleAPIClient is connected @Override public void onConnected(Bundle connectionHint) { LocationServices.FusedLocationApi.requestLocationUpdates( mGoogleApiClient, mLocationRequest, this); }
LocationManager
使用:LocationManager locationManager = (LocationManager) getActivity(). getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
Googleは彼らのチュートリアル"Receiving Location Updates"方法1
を推進しているようです。方法2
が私のためにうまくいっているので(私はアプリの2つの異なる場所で両方の方法を使用しているので)、方法1
の利点が何であるかはわかりません。
この回答も確認[link](http://stackoverflow.com/questions/37395614/locationmanager-uses-fusedlocationproviderapi/37396211#37396211) – Blackkara