LocationListener が実装されているサービスが、500ms ごとに GPSupdate を受信するという問題があります。requestLocationUpdates 関数に入力した minTime に関係なく。
私のコードの一部:
public class LocationService extends Service implements LocationListener {
LocationManager locMan;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
locMan = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locMan.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER;
locMan.requestLocationUpdates( LocationManager.GPS_PROVIDER, 60000, 1, this);
}
public void onLocationChanged(Location location) {
Log.d( "Loc", "Location has been changed" );
}
}
メイン アクティビティのボタンから startService() を呼び出します。この後、バックグラウンドで実行する必要がありますが、継続的に更新されます。