Location not getting correctly.
See original GitHub issueHi,
I’m trying to develop a driver tracking application. At first I was using just Android’s LocationManager API with GPS as the only provider. The output was not so perfect, it had jumps all over my route.
It was then I tried using this library. But I lost a lot of locations after that.
In this picture Red line shows my route towards destination and Green line shows my route back to where I started. And you can clearly see from the picture that only a few point are plotted. But out of my surprise I got the exact point from where I took the U turn.
NB: The vehicle was continuously moving throughout the route.
My system requires a foreground notification and I’m writing my code on that service. Here is what I included in the code: ` public class LocationService extends Service implements LocationServiceInterface { …
private GeohashRTFilter m_geoHashRTFilter;
@Override
public void onCreate() {
super.onCreate();
m_geoHashRTFilter = new GeohashRTFilter(Utils.GEOHASH_DEFAULT_PREC, Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT); startForeground(KEY_NOTIFICATION_ID, getForegroundNotification); }
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
ServicesHelper.addLocationServiceInterface(this);
ServicesHelper.getLocationService(this, value -> {
if (value.IsRunning()) {
return;
}
m_geoHashRTFilter.stop();
value.stop();
KalmanLocationService.Settings settings =
new KalmanLocationService.Settings(Utils.ACCELEROMETER_DEFAULT_DEVIATION,
Utils.GPS_MIN_DISTANCE,
Utils.GPS_MIN_TIME,
Utils.GEOHASH_DEFAULT_PREC,
Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
Utils.SENSOR_DEFAULT_FREQ_HZ,
null, false, Utils.DEFAULT_VEL_FACTOR, Utils.DEFAULT_VEL_FACTOR);
value.reset(settings);
value.start();
});
return START_STICKY;
}
@Override public void locationChanged(Location location) { if (location != null ) { DataManager.getInstance(LocationService.this) .saveDeviceTracking(location.getLatitude(), location.getLongitude()); } } … }`
Please help me if I’m missing anything in this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
@Lezh1k about the (0,0) coordinates. I was getting those too. For me the reason was that i was using an emulator without sensors. So i was only getting sdi from
onLocationChange
and so the KalmanFilter was never “initialized” with a Sensor event. I fixed it as explained here https://github.com/maddevsio/mad-location-manager/issues/52#issuecomment-533188474Check your GPS frequency I bet it’s 1Hz or bellow and you are not having enough points GEOHASH_DEFAULT_MIN_POINT_COUNT for the precision GEOHASH_DEFAULT_PREC.
Try walking instead of driving a car… lol