Skip to content

Instantly share code, notes, and snippets.

@justintoth
Created April 25, 2012 13:54
Show Gist options
  • Save justintoth/2489887 to your computer and use it in GitHub Desktop.
Save justintoth/2489887 to your computer and use it in GitHub Desktop.
Sygic Navigate To
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