question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Location not getting correctly.

See original GitHub issue

Hi,

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.

route

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:closed
  • Created 5 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
farfromrefugcommented, Sep 20, 2019

@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-533188474

0reactions
thxmxxcommented, Aug 29, 2019

Check 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find & improve your location's accuracy - - Google Help
Google Maps may have trouble finding your location. If the GPS location of your blue dot on the map is inaccurate or missing,...
Read more >
Top 6 Ways to Fix Location Services Not Working on Android
1. Enable and Disable Airplane Mode · 2. Enable Google Location Accuracy · 3. Check Location Permissions · 4. Correct Date and Time...
Read more >
Fix Location Problem In Google Maps! [Android] - YouTube
Google Maps giving you trouble, such as Map GPS not working, showing wrong location, the direction arrow not working and so on?
Read more >
11 methods to fix Android GPS not working - Carlcare Service
11 methods to fix Android GPS not working · Turn off and on GPS again · Turn on and turn off Airplane mode...
Read more >
How To Fix Google Maps Showing Wrong GPS Location on ...
Go to Settings and look for the option named Location and ensure that your location services are ON. · Now the first option...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found