Reputation: 108
I'm developing a mock location application for myself and had good success so far. I can set de desired location and it is shown in google maps.
My Problem is that sometimes the location switches to the real location provided by the gps module of my nexus 7 LTE (2013) with Android 6.0.1.
I set the location service to device only and i use the provider LocationManager.GPS_PROVIDER
This is what i use to set the desired location:
newLocation.setLatitude(lat);
newLocation.setLongitude(lon);
newLocation.setTime(System.currentTimeMillis());
newLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
newLocation.setSpeed((float) (speed / 3.6));
accuracy = (float) generateRandomDouble(ACCURACY_MIN, ACCURACY_MAX);
newLocation.setAccuracy(accuracy);
newLocation.setAltitude(altitude);
What did i try to solve this:
Similar questions to location mocking like Mock GPS location issue didn't help either.
What i noticed is that those jumps occur less often if the gps can't get a good signal.
Does anyone have suggestions on how to avoid those 'jumps'?
Upvotes: 3
Views: 676
Reputation: 108
I found a way to block the internal GPS with aluminium foil.
That's not the solution i was hoping for but this works fine no more jumps.
Upvotes: 1