PDA

View Full Version : [Android] SKNavigationType.REAL - reportNewGPSPosition



PatrickZenker
08.01.2016, 19:42
Hey Forum,

iam new in the Skobbler SDK world.

Ive followed the instructions of ""How to" for the Android SDK". The map is showed and i can rotate, zoom,...
Then i tryed the navigation module with "Navigating a route". When i use the example code snippet (see below), everything works fine.



@Override
public void onAllRoutesCompleted() {
System.out.println("onAllRoutesCompleted");
SKNavigationSettings navigationSettings = new SKNavigationSettings();
navigationSettings.setNavigationType(SKNavigationS ettings.SKNavigationType.SIMULATION);

SKNavigationManager navigationManager = SKNavigationManager.getInstance();
navigationManager.setMapView(mapView);
navigationManager.setNavigationListener(ActivityMa p.this);
navigationManager.startNavigation(navigationSettin gs);
skToolsNavigationInProgress = true;
}

After changing to SKNavigationType.REAL there is only the route displayed. Ive implemented my on location listener for adjusting LocationManager.requestLocationUpdates with different Criteria. After i received an location update i use the following code:


@Override
public void positionUpdate(LatLng currentPosition, float accuracy) {
SKPosition skPosition = new SKPosition(currentPosition.longitude, currentPosition.latitude, (double) 0.0, (double) accuracy, (double) 0.0, 0.0D, 0.0);
SKPositionerManager.getInstance().reportNewGPSPosi tion(this.currentPosition);
}

But now nothing happens with the initial current position of the calculated and displayed route. What am I doing wrong?

Im getting updates regularly with onUpdateNavigationState - it seems that something is working in the background but just without position updates.

As you can see in my attachments the current position is updated and showed as a SKAnnotation (left image is the first update (gps, very bad accuracy), right image the second (via wlan with good accuracy))

Best regards,
Patrick

PatrickZenker
11.01.2016, 13:39
Hey Forum,

if i move with GPS in the real word the SDK perform location updates at the map view.

But if i want to emulate several updates at the position far away, nothing happens (see Attachment). Why? :/ I there a threshold for a minimum distance or a minimum count of position update until the map gets updated?

mz87
16.01.2016, 14:07
You shouldn't do that by yourself .. SKMaps can do this good enough without your assistance ..


@Override
public void onCurrentPositionUpdate(SKPosition curpos) {

if (curpos != null && mapView != null) {
mapView.reportNewGPSPosition(this.currentPosition) ;
}
}
.....
/**
* Current position provider
*/
private SKCurrentPositionProvider currentPositionProvider;

@Override
protected void onCreate(Bundle savedInstanceState) {
currentPositionProvider = new SKCurrentPositionProvider(this);
currentPositionProvider.setCurrentPositionListener (this);
currentPositionProvider.requestLocationUpdates(tru e, true, true);
currentPositionProvider.requestUpdateFromLastPosit ion();
}


Anyway, I'm facing the huge GPS position "jumps" at home as well .. sometimes even around 500-800m from my current position with WLAN .. I think that's because of poor device ..
My colleague hasn't such problems with iPhone.