Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: [Android] Can't get navigation informations

  1. #1
    Neuer skobbler
    Join Date
    05.07.2015
    Posts
    3

    [Android] Can't get navigation informations

    Hello,

    We, a friend and I, are currently developing a GPS app on both iOS and Android, including a navigation system. So the navigation works fine on iOS, the street name, advice visual, current speed and all are displayed, meanwhile on Android I can't retrieve the current state of the navigation (using the SKNavigationState class), all the variable is showing "null" or weird values like "-1545784588" (n.b. : this is not the real value). I've tried everything, and it's seems like I will lose a lot of time trying to "rewrite" the class from stratch, so I'm asking this question : is anyone already have this issue, if so how can I fix it ?

  2. #2
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Hello,

    Can you please share the code snippets that you are using (Android)?

  3. #3
    Neuer skobbler
    Join Date
    05.07.2015
    Posts
    3
    Thanks for the answer

    The whole class is pretty big in size so i'll put just the interesting part.

    I'm using a button to start the navigation after calcutating the route between my current position and a geocoded adress

    So here is the button code :

    Code:
     itineraireButton.setOnClickListener(new OnClickListener() {
    		
    			@Override
    			public void onClick(View v) {
    				
    			     SKRouteSettings route = new SKRouteSettings();
    			    
    			      route.setStartCoordinate(TPLocation.getLocation());
    			      route.setDestinationCoordinate(TPPlace.getLocation());
    			   
    			      route.setNoOfRoutes(1);
    			     
    			      route.setRouteMode(SKRouteSettings.SKRouteMode.CAR_FASTEST);
    			      
    			      route.setRouteExposed(true);
    
    			      SKRouteManager.getInstance().setRouteListener(MapActivity.this);
    			      
    			       SKRouteManager.getInstance().calculateRoute(route);
    			}
    		});

    And the RouteListener implementation :

    Code:
    @Override
    	public void onAllRoutesCompleted() {
    		launchNavigation();
    	}
    
    // the others methods to be overridden are empty
    The launchNavigation method and the implemented method


    Code:
    private void launchNavigation() {
           
           SKNavigationSettings navigationSettings = new SKNavigationSettings();
            
            navigationSettings.setNavigationType(SKNavigationType.SIMULATION); // --> doesnt work either with real or simulation
            
            SKNavigationManager navigationManager = SKNavigationManager.getInstance();
            navigationManager.setMapView(mapView);
            
            navigationManager.setNavigationListener(this);
    
           
            navigationManager.startNavigation(navigationSettings);
            navigationInProgress = true;
        }
    
    
       @Override
    	public void onUpdateNavigationState(SKNavigationState navigationState) {
    		Log.d("NAVIGATION STATE", navigationState.toString());
    	}
    The logs shows me this :

    Code:
    07-06 11:21:41.357: D/NAVIGATION STATE(23939): SKNavigationState [adviceID=-1, currentSpeed=8.48764990139376E-59, currentSpeedLimit=0.0, countryCode=, lastAdvice=false, showSignPost=false, currentAdviceCurrentStreetName=, currentAdviceNextStreetName=, currentAdviceCurrentOsmStreetType=UNDEFINED, currentAdviceNextOsmStreetType=UNDEFINED, currentAdviceDistanceToAdvice=-1596904064, currentAdviceTimeToDestination=-1597223088, currentAdviceDistanceToDestination=-1596904256, currentAdviceVisualAdviceFile=, currentAdviceAudioAdvices=[None], currentAdviceExitNumber=, nextAdviceCurrentStreetName=, nextAdviceNextStreetName=, nextAdviceDistanceToAdvice=-1596939744, nextAdviceVisualAdviceFile=, nextAdviceCurrentOsmStreetType=UNDEFINED, nextAdviceNextOsmStreetType=UNDEFINED, distanceToDestination=0.0, firstCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=0.0, turnToRight=false, directionUK=false, allowedRoutesAngles=null, forbiddenRoutesAngles=null], secondCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=0.0, turnToRight=false, directionUK=false, allowedRoutesAngles=null, forbiddenRoutesAngles=null], adviceInstruction=, viaPointsInfo=null]

    I've provided everything I found interesting, if you need anything else let me know, and thanks again for the help.

  4. #4
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    Looking at the code you provided, everything seems ok (I can't spot any problems).

    In the demo project I've inserted a log in one of the onUpdateNavigationState listeners (i.e. the one attached to the Routing and navigation menu entry), and it behaves as expected (i.e. I get real results)

    Code:
    [adviceID=4, currentSpeed=16.666666666666668, currentSpeedLimit=0.0, countryCode=US, lastAdvice=false, showSignPost=true, currentAdviceCurrentStreetName=19th Street, currentAdviceNextStreetName=Pennsylvania Avenue, currentAdviceCurrentOsmStreetType=RESIDENTIAL, currentAdviceNextOsmStreetType=SECONDARY, currentAdviceDistanceToAdvice=6, currentAdviceTimeToDestination=424, currentAdviceDistanceToDestination=8519, currentAdviceVisualAdviceFile=/data/data/com.skobbler.sdkdemo/files/SKMaps//Advisor/Visual/772372/0.png, currentAdviceAudioAdvices=[now, turn_left, onto, Pennsylvania Avenue], currentAdviceExitNumber=, nextAdviceCurrentStreetName=Pennsylvania Avenue, nextAdviceNextStreetName=Mariposa Street, nextAdviceDistanceToAdvice=81, nextAdviceVisualAdviceFile=, nextAdviceCurrentOsmStreetType=SECONDARY, nextAdviceNextOsmStreetType=SECONDARY, distanceToDestination=8519.0, firstCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=180.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[91.0, -1.0], forbiddenRoutesAngles=null], secondCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=2.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[90.0], forbiddenRoutesAngles=null], adviceInstruction=now turn left  onto Pennsylvania Avenue  , viaPointsInfo=null]
    07-08 00:42:21.461  13159-13159/? D/Navigation state demo﹕ SKNavigationState [adviceID=4, currentSpeed=16.666666666666668, currentSpeedLimit=0.0, countryCode=US, lastAdvice=false, showSignPost=true, currentAdviceCurrentStreetName=19th Street, currentAdviceNextStreetName=Pennsylvania Avenue, currentAdviceCurrentOsmStreetType=RESIDENTIAL, currentAdviceNextOsmStreetType=SECONDARY, currentAdviceDistanceToAdvice=1, currentAdviceTimeToDestination=424, currentAdviceDistanceToDestination=8514, currentAdviceVisualAdviceFile=/data/data/com.skobbler.sdkdemo/files/SKMaps//Advisor/Visual/772372/0.png, currentAdviceAudioAdvices=[now, turn_left, onto, Pennsylvania Avenue], currentAdviceExitNumber=, nextAdviceCurrentStreetName=Pennsylvania Avenue, nextAdviceNextStreetName=Mariposa Street, nextAdviceDistanceToAdvice=81, nextAdviceVisualAdviceFile=, nextAdviceCurrentOsmStreetType=SECONDARY, nextAdviceNextOsmStreetType=SECONDARY, distanceToDestination=8514.0, firstCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=180.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[91.0, -1.0], forbiddenRoutesAngles=null], secondCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=2.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[90.0], forbiddenRoutesAngles=null], adviceInstruction=now turn left  onto Pennsylvania Avenue  , viaPointsInfo=null]
    07-08 00:42:23.831  13159-13159/? D/Navigation state demo﹕ SKNavigationState [adviceID=7, currentSpeed=16.666666666666668, currentSpeedLimit=0.0, countryCode=US, lastAdvice=false, showSignPost=true, currentAdviceCurrentStreetName=Pennsylvania Avenue, currentAdviceNextStreetName=Mariposa Street, currentAdviceCurrentOsmStreetType=SECONDARY, currentAdviceNextOsmStreetType=SECONDARY, currentAdviceDistanceToAdvice=248, currentAdviceTimeToDestination=421, currentAdviceDistanceToDestination=8477, currentAdviceVisualAdviceFile=/data/data/com.skobbler.sdkdemo/files/SKMaps//Advisor/Visual/772372/1.png, currentAdviceAudioAdvices=[in_open, 200_meters, turn_right, onto, Mariposa Street], currentAdviceExitNumber=, nextAdviceCurrentStreetName=Mariposa Street, nextAdviceNextStreetName=I280 , nextAdviceDistanceToAdvice=50, nextAdviceVisualAdviceFile=, nextAdviceCurrentOsmStreetType=SECONDARY, nextAdviceNextOsmStreetType=MOTORWAY_LINK, distanceToDestination=8477.0, firstCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=1.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[94.0, 180.0], forbiddenRoutesAngles=null], secondCrossingDescriptor=SKCrossingDescriptor [crossingType=0, routeAngle=2.0, turnToRight=false, directionUK=false, allowedRoutesAngles=[90.0], forbiddenRoutesAngles=null], adviceInstruction=in 200 meters turn right  onto Mariposa Street  , viaPointsInfo=null]
    07-08 00:42:24.136  13159-13159/? D/Navigation state demo﹕ SKNavigationState
    Can you try and replicate your issue in our demo app?

  5. #5
    Neuer skobbler
    Join Date
    05.07.2015
    Posts
    3
    Yes I've got real results too with the demo app. I kinda solved my issue about an hour ago by copying the whole demo project, rename it with my app name and get rid of everything I didn't wanted/use, fixed some packages/dependencies error and launched, and hooray I finally got real values. I still don't know where the problem come from, I guess it's some project issue or something, but for everyone in the future who encounter the similar issue I suggest you do the same I did, for the moment, at least it will save you a lot of time. And thanks of course for the help and the answer provided.

  6. #6
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    We're glad to hear you managed to get it to work!

  7. #7
    Etablierter skobbler
    Join Date
    19.07.2015
    Posts
    23
    Quote Originally Posted by Beplace View Post
    Yes I've got real results too with the demo app. I kinda solved my issue about an hour ago by copying the whole demo project, rename it with my app name and get rid of everything I didn't wanted/use, fixed some packages/dependencies error and launched, and hooray I finally got real values. I still don't know where the problem come from, I guess it's some project issue or something, but for everyone in the future who encounter the similar issue I suggest you do the same I did, for the moment, at least it will save you a lot of time. And thanks of course for the help and the answer provided.
    I'm actually having the same problem here, I posted it in http://stackoverflow.com/questions/3...tion-ui-issues and I couldn't make it work as you did, It's a very large project and I cannot dump everything and start again.

    As I post in Stack Overflow, I'm using SKTools for doing the navigation, but the route calculation is done by myself. I calculate the route in one activity, set the route by his unique ID, and later on I start the other activity which launches the navigation. The route is correctly displayed on screen, but all the advices are like yours, just trash data.

    Any thoughts on this?

  8. #8
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Could you please send us your demo project, so that we can take a closer look at your code?

  9. #9
    Etablierter skobbler
    Join Date
    19.07.2015
    Posts
    23
    I found out the issue, if the SKAdvisorSettings are not properly configured (like the path to the sources for the advices) you get that kind of error, It could be useful if SKAdvisorSettings throws some kind of error to let the developer know that something is wrong with the configuration.

  10. #10
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Thanks gabri15 for adding this solution to the thread

Posting Permissions

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