Android Java SDK for Sygic 3D
ApiNavigation Class Reference

Static Public Member Functions

static GpsPosition getActualGpsPosition (boolean satInfo, int maxTime) throws GpsException
 Returns informations about actual GPS position. More...
 
static String getRouteStatus (int maxTime) throws GeneralException
 Returns information about the navigation progress on a route in the json format. More...
 
static void startNavigation (WayPoint location, int flags, boolean searchAddress, int maxTime) throws NavigationException
 Starts navigation to a given location. More...
 
static void stopNavigation (int maxTime) throws GeneralException
 Stops navigation. More...
 
static void navigateToAddress (String strAddress, boolean postal, int flags, int maxTime) throws NavigationException
 Calculates the route from the current GPS position to a given destination and starts navigation. More...
 
static String loadComputedRoute (String routePath, int startWpId, int maxTime) throws LoadRouteException
 Loads a precomputed route (guided route) from a file and starts navigation following that route. More...
 
static String loadComputedRoute (String routePath, int maxTime) throws LoadRouteException
 Loads a precomputed route (guided route) from a file and starts navigation following that route. More...
 
static String getRoute (int format, int detail, int maxTime) throws GeneralException
 Returns a route geometry of the currently calculated route in the json format. More...
 

Static Public Attributes

static final int ASK_DELETE_ROUTE = 0x00000002
 commands Navigation to prompt user whether to delete currently computed route. More...
 
static final int MESSAGE_AVOID_MOTORWAYS_ENABLE = 0x00000004
 commands Navigation to notify user that not all motorways can be avoided. More...
 
static final int MESSAGE_AVOID_TOLL_ROADS_ENABLE = 0x00000008
 commands Navigation to notify user that not all toll roads can be avoided. More...
 
static final int MESSAGE_AVOID_FERRIES_ENABLE = 0x00000010
 commands Navigation to notify user that not all ferries can be avoided. More...
 
static final int MESSAGE_ROUTE_ENABLE = 0x00000020
 commands Navigation to notify user that route can not be computed. More...
 
static final int MESSAGE_WAYPOINTS_DISTANT = 0x00000040
 commands Navigation to notify user that route can not be computed because of too big distance between start and destination points. More...
 

Member Function Documentation

◆ getActualGpsPosition()

static GpsPosition getActualGpsPosition ( boolean  satInfo,
int  maxTime 
) throws GpsException
static

Returns informations about actual GPS position.

Parameters
satInfoFlag determining whether function should return satellites information.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Returns
model.GpsPosition instance, which contains information about GPS position.

Notes:

The function getActualGpsPosition needs Navigation to have valid GPS position. If valid GPS position is not present, function returns null.

Exceptions
GpsExceptionthe gps exception

References Api.getInstance(), Api.getService(), and GpsPosition.readBundle().

◆ getRoute()

static String getRoute ( int  format,
int  detail,
int  maxTime 
) throws GeneralException
static

Returns a route geometry of the currently calculated route in the json format.

Parameters
formatrequested json format of the geometry, 0 - Sygic format, 1 - PTV format route is loaded.
detaillevel of detail, 1 - waypoints and road geometry points, other values reserved
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Returns
string that contains the route geometry in the json format
Exceptions
GeneralExceptionthe general exception
Remarks
See the documentation about the JSON Route Import/Export object for input and output formats
See also
ApiNavigation.getRouteStatus

References Api.getInstance(), and Api.getService().

◆ getRouteStatus()

static String getRouteStatus ( int  maxTime) throws GeneralException
static

Returns information about the navigation progress on a route in the json format.

Parameters
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Returns
string that contains the route status in the json format
Exceptions
GeneralExceptionthe general exception
Remarks
See the documentation about the JSON structure
See also
ApiItinerary.addItinerary

References Api.getInstance(), and Api.getService().

◆ loadComputedRoute() [1/2]

static String loadComputedRoute ( String  routePath,
int  startWpId,
int  maxTime 
) throws LoadRouteException
static

Loads a precomputed route (guided route) from a file and starts navigation following that route.

Parameters
routePathPath and filename of the RSAV or JSON file, from which the route is loaded.
startWpIdthe start waypoint id
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Returns
json report of approximation result
Exceptions
LoadRouteExceptionthe exception related to problems of route loading
Remarks
See the documentation about the JSON Route Import/Export object for input and output formats

References Api.getInstance(), and Api.getService().

Referenced by ApiNavigation.loadComputedRoute().

◆ loadComputedRoute() [2/2]

static String loadComputedRoute ( String  routePath,
int  maxTime 
) throws LoadRouteException
static

Loads a precomputed route (guided route) from a file and starts navigation following that route.

Parameters
routePathPath and filename of the RSAV or JSON file, from which the route is loaded.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Returns
json report of approximation result
Exceptions
LoadRouteExceptionthe exception related to problems of route loading
Remarks
See the documentation about the JSON Route Import/Export object for input and output formats

References ApiNavigation.loadComputedRoute().

◆ navigateToAddress()

static void navigateToAddress ( String  strAddress,
boolean  postal,
int  flags,
int  maxTime 
) throws NavigationException
static

Calculates the route from the current GPS position to a given destination and starts navigation.

Parameters
strAddressSpecifies address of the route destination. Address must be in the format "iso,city/zip,street,house number"
postalFlag determining whether the second address parameter represents city or zip code.
  • true - zip or postal code
  • false - city
flagsDetermines route computing preferences.
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
NavigationExceptionthe navigation exception
Remarks
To use this function it is necessary to have valid GPS signal and the address location must be situated on the loaded map
Parameter flags determines some route computing preferences. Possible values are enumerated in ApiNavigation enum. For example, it is possible notify user that not all toll roads can be avoided. To join more flags together use logical "or" operator.
In order to disable any dialog interactions with user, set flags=0.
The house number address parameter is optional. If you do not want to fill it, write the address in the shorter form, e.g. "DEU,Berlin,Alexanderplatz,"
The second address parameter can represent a city name or a zip code.
The list of ISO codes can be found at here
The ISO code for United States consists of the character "U" plus the code of a state. E.g New York is UNY.
See also
startNavigation

References Api.getInstance(), and Api.getService().

◆ startNavigation()

static void startNavigation ( WayPoint  location,
int  flags,
boolean  searchAddress,
int  maxTime 
) throws NavigationException
static

Starts navigation to a given location.

Parameters
locationmodel.WayPoint instance, which contains the information about the destination, specifically the GPS coordinates
flagsDetermines route computing behavior
searchAddressFlag determining whether the Location parameter will be updated with a reverse geocoded address
  • true - updates the address member of Location with reverse geocoded address from its GPS coordinates
  • false - keeps the address member of Location unchanged
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited
Exceptions
NavigationExceptionthe navigation exception
Remarks
For successful operation it is neccessary to have the destination location on the road network, otherwise the exception "address not found" can be thrown.
The function uses the current valid GPS signal or any last valid GPS position as a start address for route calculation. If there is no last valid signal the exception "waiting for valid signal" can be thrown.
The parameter flags determines route calculation dialog behavior. Possible values are enumerated in ApiNavigation. For example, it is possible to notify user that not all toll roads could have been avoided. To join more flags together use the logical "or" operator.
In order to disable any dialog interactions with user, set flags=0.
The parameter searchAddress operates from the sdk version 4.2.2 on.
See also
ApiLocation.locationFromAddress

References Api.getInstance(), Api.getService(), and WayPoint.writeBundle().

◆ stopNavigation()

static void stopNavigation ( int  maxTime) throws GeneralException
static

Stops navigation.

Parameters
maxTimeMaximum time (in milliseconds) the function can take. If maxTime=0 function execution is not time limited.
Exceptions
GeneralExceptionthe general exception

References Api.getInstance(), and Api.getService().

Member Data Documentation

◆ ASK_DELETE_ROUTE

final int ASK_DELETE_ROUTE = 0x00000002
static

commands Navigation to prompt user whether to delete currently computed route.

Navigation asks user to delete computed route before computing new route if some route is computed.

◆ MESSAGE_AVOID_FERRIES_ENABLE

final int MESSAGE_AVOID_FERRIES_ENABLE = 0x00000010
static

commands Navigation to notify user that not all ferries can be avoided.

Navigation shows message which notice user that not all ferries can be avoided if user wished to avoid them.

◆ MESSAGE_AVOID_MOTORWAYS_ENABLE

final int MESSAGE_AVOID_MOTORWAYS_ENABLE = 0x00000004
static

commands Navigation to notify user that not all motorways can be avoided.

Navigation shows message which notice user that not all motorways can be avoided if user wished to avoid them.

◆ MESSAGE_AVOID_TOLL_ROADS_ENABLE

final int MESSAGE_AVOID_TOLL_ROADS_ENABLE = 0x00000008
static

commands Navigation to notify user that not all toll roads can be avoided.

Navigation shows message which notice user that not all toll roads can be avoided if user wished to avoid them.

◆ MESSAGE_ROUTE_ENABLE

final int MESSAGE_ROUTE_ENABLE = 0x00000020
static

commands Navigation to notify user that route can not be computed.

For example this could happen if start or destination point of route are out of loaded maps.

◆ MESSAGE_WAYPOINTS_DISTANT

final int MESSAGE_WAYPOINTS_DISTANT = 0x00000040
static

commands Navigation to notify user that route can not be computed because of too big distance between start and destination points.

For example if route is computed for walking.