Results 1 to 3 of 3

Thread: [Android] SKNavigationType.REAL - reportNewGPSPosition

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Etablierter skobbler
    Join Date
    08.01.2016
    Location
    Lübeck
    Posts
    20

    [Android] SKNavigationType.REAL - reportNewGPSPosition

    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.

    Code:
        @Override
        public void onAllRoutesCompleted() {
            System.out.println("onAllRoutesCompleted");
            SKNavigationSettings navigationSettings = new SKNavigationSettings();
            navigationSettings.setNavigationType(SKNavigationSettings.SKNavigationType.SIMULATION);
    
            SKNavigationManager navigationManager = SKNavigationManager.getInstance();
            navigationManager.setMapView(mapView);
            navigationManager.setNavigationListener(ActivityMap.this);
            navigationManager.startNavigation(navigationSettings);
            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:
    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().reportNewGPSPosition(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
    Attached Images Attached Images
    Last edited by PatrickZenker; 11.01.2016 at 11:03.

  2. #2
    Etablierter skobbler
    Join Date
    08.01.2016
    Location
    Lübeck
    Posts
    20
    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?
    Attached Images Attached Images
    Last edited by PatrickZenker; 11.01.2016 at 14:04.

  3. #3
    Etablierter skobbler
    Join Date
    11.04.2015
    Posts
    41
    You shouldn't do that by yourself .. SKMaps can do this good enough without your assistance ..

    Code:
       @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(true, true, true);
            currentPositionProvider.requestUpdateFromLastPosition();
         }
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •