Created
April 25, 2012 13:54
-
-
Save justintoth/2489887 to your computer and use it in GitHub Desktop.
Sygic Navigate To
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void navigateTo(Float latitude, Float longitude, int numTries) { | |
try | |
{ | |
Log("Navigating to: " + latitude + " / " + longitude + " for try #" + numTries); | |
Integer lat = (int)(latitude * 100000); | |
Integer lon = (int)(longitude * 100000); | |
//get lat/long of address. | |
SWayPoint wayPoint = new SWayPoint(); | |
wayPoint.Location = new LONGPOSITION(lon, lat); | |
//start navigation. | |
Log("Starting navigation for " + wayPoint.Location.lX + " / " + wayPoint.Location.lY); | |
ApplicationAPI.StartNavigation(error, wayPoint, NavigationParams.NpMessageAvoidTollRoadsUnable, true, true, 0); | |
Log("Start navigation result: " + error.nCode + " " + error.GetDescription()); | |
//if waiting for init api or gps, call in a bit. | |
if(error.nCode == -6 && numTries < 18) | |
{ | |
Thread.sleep(5000); | |
navigateTo(latitude, longitude, numTries + 1); | |
} | |
} | |
catch(Exception exc) | |
{ | |
Log(exc.getMessage()); | |
exc.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment