Class Sdk
public final class Sdk
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sdk.ConfigurationSettings
This class describes the SDK initialization settings.static interface
Sdk.DayNightChangeListener
static class
Sdk.InitializationFailureReason
static interface
Sdk.PoiCategoriesListener
static class
Sdk.State
The current state of the SDK.static interface
Sdk.StateChangeListener
-
Method Summary
Modifier and Type Method Description void
addDayNightChangeListener(Sdk.DayNightChangeListener listener)
Adds the listener, that will be notified, when current time switches from day to night and vice versa.void
addPoiCategoriesListener(Sdk.PoiCategoriesListener listener)
Adds the listener, that will be notified when the list of POI categories has been downloaded.void
addStateChangeListener(Sdk.StateChangeListener listener)
Adds the specified listener to the list of SDK state change listeners.void
deinitializeSdk()
Deinitializes the SDK.java.lang.String
getDeviceId()
Sdk.InitializationFailureReason
getInitializationFailureReason()
Provides an information about initialization failure if SDK initialization has failed: (getState()
returnsSdk.State.INITIALIZATION_FAILED
).static Sdk
getInstance()
MapManager
getMapManager()
NavigationManager
getNavigationManager()
PoiCategory[]
getPoiCategories()
Returns the list of available POI categories.PoiCategory
getPoiCategory(int id)
Returns the POI category by its id.PositionManager
getPositionManager()
RouteNavigator
getRouteNavigator()
RouteVisualizer
getRouteVisualizer()
RoutingManager
getRoutingManager()
SearchManager
getSearchManager()
Sdk.State
getState()
TrafficManager
getTrafficManager()
static java.lang.String
getVersion()
void
initSdkAsync(android.content.Context context, Sdk.ConfigurationSettings configurationSettings)
Starts the SDK.boolean
isNight()
boolean
isPaused()
void
pause()
Pauses the SDK.void
pauseGraphics()
Switches off map rendering.void
removeDayNightChangeListener(Sdk.DayNightChangeListener listener)
Removes the specified listener from the list.void
removePoiCategoriesListener(Sdk.PoiCategoriesListener listener)
Removes the specified listener from the list.void
removeStateChangeListener(Sdk.StateChangeListener listener)
Removes the specified listener from the list.void
resume()
Resumes the SDK.void
resumeGraphics()
Switches on map rendering.void
setActiveMapView(MapView mapView)
Sets theMapView
which will be used to render the map.
-
Method Details
-
getInstance
-
initSdkAsync
public void initSdkAsync(android.content.Context context, Sdk.ConfigurationSettings configurationSettings)Starts the SDK.Use this method to initialize the SDK. The process of initialization is asynchronous. Use
Sdk.StateChangeListener
to know when initialization has been finished.- If SDK state is
Sdk.State.UNINITIALIZED
orSdk.State.INITIALIZATION_FAILED
, regular initialization is started. - If SDK is already inSdk.State.INITIALIZED
state, then method is no-op regardless of whetherconfigurationSettings
are the same as settings used for previous initialization. - If SDK state isSdk.State.INITIALIZING
and deinitialization is pending (i.e.deinitializeSdk()
was called inSdk.State.INITIALIZING
state), then pending deinitialization is cancelled, and initialization with newconfigurationSettings
will be started once currently running initialization completes (successfully or not). In this case, there won't be a notification about completion of currently running initialization. Instead, there will be only notification about completion of initialization triggered by latest call toinitSdkAsync
. - If SDK state isSdk.State.INITIALIZING
, no deinitialization is pending, and providedconfigurationSettings
are the same as settings for already running initialization, then method is no-op. - If SDK state isSdk.State.INITIALIZING
, no deinitialization is pending, and providedconfigurationSettings
are different from settings used for already running initialization, then initialization with provided settings will be scheduled to start once currently running initialization completes. In this case, there won't be a notification about completion of currently running initialization. Instead, there will be only notification about completion of initialization triggered by latest call toinitSdkAsync
.Do not call this method synchronously in
Sdk.StateChangeListener
callback.- Parameters:
context
- The context.configurationSettings
- Configuration settings.
-
deinitializeSdk
public void deinitializeSdk()Deinitializes the SDK.Use this method to stop and deinitialize the SDK.
- If SDK state is
Sdk.State.INITIALIZED
, then regular deinitialization is performed. - If SDK state isSdk.State.INITIALIZING
, then actual deinitialization will be postponed until initialization finishes (successfully or not): once SDK initialization completes, SDK will skipSdk.State.INITIALIZED
orSdk.State.INITIALIZATION_FAILED
states, going directly toSdk.State.UNINITIALIZED
state. - If SDK is inSdk.State.UNINITIALIZED
orSdk.State.INITIALIZATION_FAILED
states, method is no-op.Do not call this method synchronously in
Sdk.StateChangeListener
callback. -
resume
public void resume()Resumes the SDK. Switches on map rendering and resumes processing. SDK state should beSdk.State.INITIALIZED
, otherwise method is no-op. -
pause
public void pause()Pauses the SDK. Switches off map rendering and pauses processing. SDK state should beSdk.State.INITIALIZED
, otherwise method is no-op. -
isPaused
public boolean isPaused() -
resumeGraphics
public void resumeGraphics()Switches on map rendering. SDK state should beSdk.State.INITIALIZED
, otherwise method is no-op. -
pauseGraphics
public void pauseGraphics()Switches off map rendering. SDK state should beSdk.State.INITIALIZED
, otherwise method is no-op. -
getInitializationFailureReason
Provides an information about initialization failure if SDK initialization has failed: (getState()
returnsSdk.State.INITIALIZATION_FAILED
). In other cases returnsnull
.- Returns:
- The reason of initialization failure.
-
getState
- Returns:
- The current state of the SDK.
-
addStateChangeListener
Adds the specified listener to the list of SDK state change listeners.- Parameters:
listener
- The listener.
-
removeStateChangeListener
Removes the specified listener from the list.- Parameters:
listener
- The listener.
-
isNight
public boolean isNight()- Returns:
- true if it's night at the current GPS position, false if it's day.
If SDK is not initialized, returns
false
.
-
addDayNightChangeListener
Adds the listener, that will be notified, when current time switches from day to night and vice versa.- Parameters:
listener
- The listener.
-
removeDayNightChangeListener
Removes the specified listener from the list.- Parameters:
listener
- The listener.
-
getPoiCategories
Returns the list of available POI categories.The categories are downloaded in background, and the returned array can be empty, if the download hasn't been finished.
Use
addPoiCategoriesListener(PoiCategoriesListener)
to know when the categories have been downloaded.- Returns:
- The array of POI categories.
-
getPoiCategory
Returns the POI category by its id.- Parameters:
id
- The category ID.- Returns:
- The POI category or null, if there is no such category.
- See Also:
addPoiCategoriesListener(PoiCategoriesListener)
-
addPoiCategoriesListener
Adds the listener, that will be notified when the list of POI categories has been downloaded.- Parameters:
listener
- The listener.
-
removePoiCategoriesListener
Removes the specified listener from the list.- Parameters:
listener
- The listener.
-
getVersion
public static java.lang.String getVersion()- Returns:
- The version of the SDK.
-
getDeviceId
public java.lang.String getDeviceId()- Returns:
- A unique device identifier generated upon the first initialization of the SDK.
Returns
null
is SDK is not inSdk.State.INITIALIZED
state.
-
setActiveMapView
Sets theMapView
which will be used to render the map. AfterMapView
is no longer active,null
must be passed to this method. Otherwise, memory leaks may occur. Must be called only if state isSdk.State.INITIALIZED
.- Parameters:
mapView
- The map view.
-
getNavigationManager
- Returns:
- The instance of the NavigationManager or null if the SDK hasn't been started.
-
getRoutingManager
- Returns:
- The instance of the RoutingManager or null if the SDK hasn't been started.
-
getRouteVisualizer
- Returns:
- The instance of the RouteVisualizer or null if the SDK hasn't been started.
-
getTrafficManager
- Returns:
- The instance of the TrafficManager or null if the SDK hasn't been started.
-
getRouteNavigator
- Returns:
- The instance of the RouteNavigator or null if the SDK hasn't been started.
-
getSearchManager
- Returns:
- The instance of the SearchManager or null if the SDK hasn't been started.
-
getMapManager
- Returns:
- The instance of the MapManager or null if the SDK hasn't been started.
-
getPositionManager
-