MapTrip SDK Android Manual 9.10.8
 
Loading...
Searching...
No Matches
ApiHelper Class Reference
+ Inheritance diagram for ApiHelper:

Public Member Functions

void addApiListener (ApiListener listener)
 
void addInitListener (ApiInitListener listener)
 
void addLicenseListener (ApiLicenseListener listener)
 
int general (GeneralCallbackType callbackType, String optionalText, double optionalNumber)
 
Iterable< DataSet > getAllDataSets ()
 
final String getApplicationPath ()
 
final String getAppVersion ()
 
final String getDeviceId ()
 
final String getDeviceId (Context context)
 
DisplayInfo getDisplayInfo ()
 
final String getIMEI ()
 
ComputationSiteParameters getInitParameters ()
 
IwLocationManager getLocationManager ()
 
final String getMapDataPath ()
 
final String getPackageName ()
 
final String getResourcePath ()
 
IwSensorManager getSensorManager ()
 
String getSoundPath ()
 
final String getTempPath ()
 
final String getUserDataPath ()
 
ApiError initialize (ComputationSiteParameters csParams, ApiInitListener listener) throws RuntimeException
 
ApiError initialize (Context applicationContext, ComputationSiteParameters csParams, ApiInitListener listener) throws RuntimeException
 
void initPaths (String apiDirPath)
 
void initPaths (String apiDirPath, String dataPath)
 
void initPaths (String appPath, String dataPath, String resourcePath, String osUserDataPath, String tempPath, String mapservicexml)
 
final boolean isApiInitialized ()
 
boolean isApiThreadAlive ()
 
boolean isCurrentThreadApiThread ()
 
boolean isSensorDataUsageEnabled ()
 
void licenceChanged ()
 
void licenceIsInvalid (ApiError error)
 
void mapContent (Iterable< MapContent > mapContentList)
 
void onApiInitError (final ApiError err, final String description)
 
void onApiInitFinished (ApiError retVal, String description)
 
void onApiInitialized ()
 
void onApiUninitialized ()
 
boolean queueApiCall (ApiTask task)
 
boolean queueApiCall (Runnable task)
 
boolean queueApiCallHighPriority (ApiTask task)
 
boolean queueApiCallHighPriority (Runnable task)
 
boolean queueApiCallLowPriority (ApiTask task)
 
boolean queueApiCallLowPriority (Runnable task)
 
void removeApiListener (ApiListener listener)
 
void removeInitListener (ApiInitListener listener)
 
void removeLicenseListener (ApiLicenseListener listener)
 
void setAllowResourceUpdate (boolean allowResourceUpdate)
 
void setLocationManager (IwLocationManager newLocationManager)
 
void setSensorDataUsageEnabled (boolean enable)
 
void setSensorManager (IwSensorManager newSensorManager)
 
void setSoundPath (String path)
 
void uninitialize ()
 

Static Public Member Functions

static ApiHelper Instance ()
 

Protected Member Functions

boolean checkApiFolders ()
 
ApiError doApiInit ()
 
void getLicense ()
 
void initializeContext (Context context)
 
void setApiInitialized (boolean isInitialized)
 
void startApiThread ()
 
void stopApiThread ()
 
void storeContextInfosForNativeAPI (Context context)
 
synchronized void uninitialize (final boolean reinit)
 
void uninitLocationAndSensorManager ()
 

Static Protected Member Functions

static String checkAndAddSlash (String str)
 

Protected Attributes

String apiAppPath
 
String apiDataPath
 
List< ApiListenerapiListenerList = new ArrayList<>()
 
String apiMapservicexml
 
String apiOsUserDataPath
 
String apiResourcePath
 
String apiTempPath
 
IwApiThread apiThread = null
 
String appVersion = ""
 
String deviceId = ""
 
String imei = ""
 
List< ApiInitListenerinitListenerList = new ArrayList<>()
 
List< ApiLicenseListenerlicenseListenerList = new ArrayList<>()
 
Object listenerMutex = new Object()
 
IwLocationManager locationManager
 
String packageName = ""
 
IwSensorManager sensorManager
 

Detailed Description

\ . has to be used to configure the SDK\'s resources paths and init / uninit the SDK

Singleton implementation

Member Function Documentation

◆ addApiListener()

void addApiListener ( ApiListener  listener)
inherited

Add a listener for only api general callback - used by the mapviewers

Parameters
listenerto add if not already there

◆ addInitListener()

void addInitListener ( ApiInitListener  listener)
inherited

Add a listener for initialization related events

Parameters
listenerto add if not already there

◆ addLicenseListener()

void addLicenseListener ( ApiLicenseListener  listener)
inherited

Add a listener for licence info

Parameters
listenerto add if not already there

◆ checkAndAddSlash()

static String checkAndAddSlash ( String  str)
staticprotectedinherited

helper function for correct ending of API paths

◆ checkApiFolders()

boolean checkApiFolders ( )
protectedinherited

Check if api folders are set and exists If API folders are not set, the method returns false If Api folders do not exist, it throws a Runtime exception

◆ doApiInit()

ApiError doApiInit ( )
protected

Call to init method with appropriate parameters

Returns
errorcode

Reimplemented from ApiHelperCommon.

◆ general()

int general ( GeneralCallbackType  callbackType,
String  optionalText,
double  optionalNumber 
)
inherited

Is called for multiple purposes.

Parameters
callbackType- See GeneralCallbackType
optionalText- Content depends on the callbackType
optionalNumber- Content depends on the callbackType
Returns
The handling of the returned value depends on the callbackType

Implements ApiListener.

◆ getAllDataSets()

Iterable< DataSet > getAllDataSets ( )

Retrieves an iterable collection of all DataSet objects configured for map data downloads.

This method provides access to all datasets from the current installation that are set up for remote updates. It ensures that a device ID for licensing is available before fetching the datasets.

Important: This method relies on a device identifier for licensing. The stability of this identifier can vary across different Android versions and may be affected by factory resets. Before calling this method, ensure that any necessary runtime permissions, such as Manifest.permission#READ_PHONE_STATE, are handled to ensure a consistent device ID. This is particularly important for maintaining a stable device ID in existing applications. Especially on Android 6-9 do not call this different order of permission handling than you call initialize(Context, ComputationSiteParameters, ApiInitListener)

Returns
An Iterable of DataSet objects for all updatable datasets. Returns an empty iterable if no datasets are configured for updates.
See also
#initialize(Context, ComputationSiteParameters, ApiInitListener)

◆ getApplicationPath()

final String getApplicationPath ( )
inherited

◆ getAppVersion()

final String getAppVersion ( )
inherited

◆ getDeviceId() [1/2]

final String getDeviceId ( )
inherited

Get the device id for this device Only works if ApiHelper isInitialized or getDeviceId(Context context) has been called

Returns
the device id String - empty if ApiHelper.isInitialized == true

◆ getDeviceId() [2/2]

final String getDeviceId ( Context  context)
inherited

Get the device id and store it for further calls - even if ApiHelper is not initiailized yet, but requires a context

Returns
the unique device id

◆ getDisplayInfo()

DisplayInfo getDisplayInfo ( )
inherited
Returns
information object of the current display

◆ getIMEI()

final String getIMEI ( )
inherited

Get the device id for this device Only works if ApiHelper isInitialized or getDeviceId(Context context) has been called

Returns
the device id String - empty if ApiHelper.isInitialized == true

◆ getInitParameters()

ComputationSiteParameters getInitParameters ( )

◆ getLicense()

void getLicense ( )
protectedinherited

Requests Server for a license - if granted api is reinitialized, otherwise apiInit error is received

◆ getLocationManager()

IwLocationManager getLocationManager ( )
inherited
Returns
locationmanager to control the GPS functions

◆ getMapDataPath()

final String getMapDataPath ( )
inherited

◆ getPackageName()

final String getPackageName ( )
inherited

◆ getResourcePath()

final String getResourcePath ( )
inherited

◆ getSensorManager()

IwSensorManager getSensorManager ( )
inherited
Returns
sensormanager for orientation updates

◆ getSoundPath()

String getSoundPath ( )
inherited
Returns
sound path to speech files

◆ getTempPath()

final String getTempPath ( )
inherited

◆ getUserDataPath()

final String getUserDataPath ( )
inherited

◆ initialize() [1/2]

ApiError initialize ( ComputationSiteParameters  csParams,
ApiInitListener  listener 
) throws RuntimeException

Initialize the Api asynchronously. The callbacks of the passed ApiInitListener indicate success or error subsequent calls on an already initialized api will not lead to further result callbacks

Parameters
csParams- computations site params for all modules, see ComputationSite
listener- listener for initialization result
Returns
ApiError#OK if initialization process is started ApiError#WRONG_PATH if initPaths(String) is not called or paths are null
Exceptions
RuntimeExceptionif the paths to the runtime data set via initPaths(String) and the appropriate sub folder (/data, /res, /user, /temp, /mapservices.xml ) do not exist on the device.

◆ initialize() [2/2]

ApiError initialize ( Context  applicationContext,
ComputationSiteParameters  csParams,
ApiInitListener  listener 
) throws RuntimeException

Initialize the Api asynchronously. The callbacks of the passed ApiInitListener indicate success or error subsequent calls on an already initialized api will not lead to further result callbacks

Parameters
applicationContextApplication Context
csParams- computations site params for all modules, see ComputationSite
listener- listener for initialization result
Returns
ApiError#OK if initialization process is started ApiError#WRONG_PATH if initPaths(String) is not called or paths are null
Exceptions
RuntimeExceptionif the paths to the runtime data set via initPaths(String) and the appropriate sub folder (/data, /res, /user, /temp, /mapservices.xml ) do not exist on the device.
Deprecated:
The application context is now managed by the SDK. Please use initialize(ComputationSiteParameters, ApiInitListener) instead.

◆ initializeContext()

void initializeContext ( Context  context)
protected

Sets the application context for the SDK.

This method is required to be called before initialize(ComputationSiteParameters, ApiInitListener). The SDK uses this context to access application-specific resources and services, such as file system paths for storing map data, and to generate a device ID for licensing.

Parameters
contextThe application\'s context. Must not be null.

◆ initPaths() [1/3]

void initPaths ( String  apiDirPath)
inherited

helper function to set the paths for the API, must be called before Initialization

Parameters
apiDirPath- absolute path to main application directory, this has to contain the folders/files: data, res, user, temp, mapservices.xml

◆ initPaths() [2/3]

void initPaths ( String  apiDirPath,
String  dataPath 
)
inherited

helper function to set the paths for the API, must be called before Initialization

Parameters
apiDirPath- absolute path to main application directory, this has to contain the folders/files: data, res, user, temp, mapservices.xml
dataPath- absolute path to overlay data as well as shape data for viewing and routing of iw-mapdata.

◆ initPaths() [3/3]

void initPaths ( String  appPath,
String  dataPath,
String  resourcePath,
String  osUserDataPath,
String  tempPath,
String  mapservicexml 
)
inherited

the paths for the API, must be called before initialization

Parameters
appPath- absolute path to main application directory
dataPath- absolute path to overlay data as well as shape data for viewing and routing of iw-mapdata.
resourcePath- absolute path to display resolution information for example as fonts, language dependent information, sound files (wav) and poi icons. The language directories (one for each language) contain poi-category files, string tables for menu, button and message strings, sound files for announcements and a TMC event list.
osUserDataPath- absolute path to user data directory, inside this directory the settings, favorites and history files are stored
tempPath- absolute path to temp directory, inside this directory temporary files will be stored
mapservicexml- absolute path to mapservices.xml file delivered by infoware (read only)

◆ Instance()

static ApiHelper Instance ( )
static

◆ isApiInitialized()

final boolean isApiInitialized ( )
inherited

◆ isApiThreadAlive()

boolean isApiThreadAlive ( )
inherited
Returns
true if api thread is alive

◆ isCurrentThreadApiThread()

boolean isCurrentThreadApiThread ( )
inherited
Returns
true if this method is executed on API Thread

◆ isSensorDataUsageEnabled()

boolean isSensorDataUsageEnabled ( )

◆ licenceChanged()

void licenceChanged ( )
inherited

Called if changes in the list of licenced features occurs

Implements LicenceListener.

◆ licenceIsInvalid()

void licenceIsInvalid ( ApiError  error)
inherited

Called if the licence is invalid

Parameters
error- errorcode describing whay the licence is invalid

Implements LicenceListener.

◆ mapContent()

void mapContent ( Iterable< MapContent mapContentList)
inherited

Retrieves a list of all possible map types

Implements ApiListener.

◆ onApiInitError()

void onApiInitError ( final ApiError  err,
final String  description 
)

callback when Api init fails

Implements ApiInitListener.

◆ onApiInitFinished()

void onApiInitFinished ( ApiError  retVal,
String  description 
)
inherited

extract result and redirect to apiListener

◆ onApiInitialized()

void onApiInitialized ( )

callback when Api is initialized in GL view. Attention: Callback returns on the GL thread and not on the main ui thread

Implements ApiInitListener.

◆ onApiUninitialized()

void onApiUninitialized ( )

callback when api is uninitialized

Implements ApiInitListener.

◆ queueApiCall() [1/2]

boolean queueApiCall ( ApiTask  task)
inherited

execute task on APIThread

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ queueApiCall() [2/2]

boolean queueApiCall ( Runnable  task)
inherited

execute task on APIThread

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ queueApiCallHighPriority() [1/2]

boolean queueApiCallHighPriority ( ApiTask  task)
inherited

execute task on APIThread with low priority. This will be exuted if no other default priority Task are enqueued.

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ queueApiCallHighPriority() [2/2]

boolean queueApiCallHighPriority ( Runnable  task)
inherited

execute task on APIThread with high priority

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ queueApiCallLowPriority() [1/2]

boolean queueApiCallLowPriority ( ApiTask  task)
inherited

execute task on APIThread with low priority. This will be exuted if no other default priority Task are enqueued.

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ queueApiCallLowPriority() [2/2]

boolean queueApiCallLowPriority ( Runnable  task)
inherited

execute task on APIThread with low priority

Parameters
task- task to execute
Returns
true if api thread running and task enqueued

◆ removeApiListener()

void removeApiListener ( ApiListener  listener)
inherited

remove a listener for only api general callback - used by the mapviewers

Parameters
listenerto remove

◆ removeInitListener()

void removeInitListener ( ApiInitListener  listener)
inherited

remove a listener for api related events like init / uninit

Only needed for IwMapView, app registers this listener with initialization

Parameters
listenerto remove

◆ removeLicenseListener()

void removeLicenseListener ( ApiLicenseListener  listener)
inherited

remove a listener for licence info

Parameters
listenerto remove

◆ setAllowResourceUpdate()

void setAllowResourceUpdate ( boolean  allowResourceUpdate)

◆ setApiInitialized()

void setApiInitialized ( boolean  isInitialized)
protectedinherited

◆ setLocationManager()

void setLocationManager ( IwLocationManager  newLocationManager)
inherited

Stop current location manager and use the new one

Parameters
newLocationManager- new locationmanager to set

◆ setSensorDataUsageEnabled()

void setSensorDataUsageEnabled ( boolean  enable)

enable sensor data usage for matching

◆ setSensorManager()

void setSensorManager ( IwSensorManager  newSensorManager)
inherited

Stop current sensor manager and use the new one

Parameters
newSensorManager- new snsormanager to use

◆ setSoundPath()

void setSoundPath ( String  path)
inherited

sets the path to the speech files, from inside the API, don't call from application

Parameters
pathto the speech files

◆ startApiThread()

void startApiThread ( )
protectedinherited

start the thread that runs the API

◆ stopApiThread()

void stopApiThread ( )
protectedinherited

Stop the ApiThread and null its instance

◆ storeContextInfosForNativeAPI()

void storeContextInfosForNativeAPI ( Context  context)
protectedinherited

◆ uninitialize() [1/2]

void uninitialize ( )
inherited

Unloads the library from memory. Please call this method ONLY before ending the applications, otherwise this may lead to exceptions.
Do not call subsequently uninitialize and initialize! This may lead to unpredictive behavior.

Attention
After uninitialization, ALL references to SDK objects e.g. mapviewer, navigation, itineraries, waypoints or iterator are invalid! Calling methods on these object will result in the errorcode ApiError.INVALID_OBJECT.

Also if the SDK is re-initialized all existing object references will return ApiError.INVALID_OBJECT on called member methods. Please re-initialize all static variables and class members.

◆ uninitialize() [2/2]

synchronized void uninitialize ( final boolean  reinit)
protectedinherited

if API thread running, we can uninit

Noify listener

◆ uninitLocationAndSensorManager()

void uninitLocationAndSensorManager ( )
protectedinherited

Stop location updates and deactivate manangers

Member Data Documentation

◆ apiAppPath

String apiAppPath
protectedinherited

Paths for API

◆ apiDataPath

String apiDataPath
protectedinherited

◆ apiListenerList

List<ApiListener> apiListenerList = new ArrayList<>()
protectedinherited

Register as API Listener and redirect callbacks to multiple clients

◆ apiMapservicexml

String apiMapservicexml
protectedinherited

◆ apiOsUserDataPath

String apiOsUserDataPath
protectedinherited

◆ apiResourcePath

String apiResourcePath
protectedinherited

◆ apiTempPath

String apiTempPath
protectedinherited

◆ apiThread

IwApiThread apiThread = null
protectedinherited

Api Thread. Started on API initialize call

◆ appVersion

String appVersion = ""
protectedinherited

◆ deviceId

String deviceId = ""
protectedinherited

Device infos for native API part

◆ imei

String imei = ""
protectedinherited

IMEI of device if available

◆ initListenerList

List<ApiInitListener> initListenerList = new ArrayList<>()
protectedinherited

Register as API Init Listener and redirect callbacks to multile clients

◆ licenseListenerList

List<ApiLicenseListener> licenseListenerList = new ArrayList<>()
protectedinherited

Register as API Licence Listener

◆ listenerMutex

Object listenerMutex = new Object()
protectedinherited

◆ locationManager

IwLocationManager locationManager
protectedinherited

location and orientation updates

◆ packageName

String packageName = ""
protectedinherited

◆ sensorManager

IwSensorManager sensorManager
protectedinherited

The documentation for this class was generated from the following file: