MapTrip SDK Android Manual 9.8.8
ApiHelperCommon Class Referenceabstract
+ Inheritance diagram for ApiHelperCommon:

Public Member Functions

void addApiListener (ApiListener listener)
 
void addInitListener (ApiInitListener listener)
 
void addLicenseListener (ApiLicenseListener listener)
 
int general (GeneralCallbackType callbackType, String optionalText, double optionalNumber)
 
final String getApplicationPath ()
 
final String getAppVersion ()
 
final String getDeviceId ()
 
final String getDeviceId (Context context)
 
DisplayInfo getDisplayInfo ()
 
final String getIMEI ()
 
IwLocationManager getLocationManager ()
 
final String getMapDataPath ()
 
final String getPackageName ()
 
final String getResourcePath ()
 
IwSensorManager getSensorManager ()
 
String getSoundPath ()
 
final String getTempPath ()
 
final String getUserDataPath ()
 
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 ()
 
void licenceChanged ()
 
void licenceIsInvalid (ApiError error)
 
void mapContent (Iterable< MapContent > mapContentList)
 
void onApiInitFinished (ApiError retVal, String description)
 
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 setLocationManager (IwLocationManager newLocationManager)
 
void setSensorManager (IwSensorManager newSensorManager)
 
void setSoundPath (String path)
 
void uninitialize ()
 

Protected Member Functions

boolean checkApiFolders ()
 
abstract ApiError doApiInit ()
 
void getLicense ()
 
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
 

Member Function Documentation

◆ addApiListener()

void addApiListener ( ApiListener  listener)

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

Parameters
listenerto add if not already there

◆ addInitListener()

void addInitListener ( ApiInitListener  listener)

Add a listener for initialization related events

Parameters
listenerto add if not already there

◆ addLicenseListener()

void addLicenseListener ( ApiLicenseListener  listener)

Add a listener for licence info

Parameters
listenerto add if not already there

◆ checkAndAddSlash()

static String checkAndAddSlash ( String  str)
staticprotected

helper function for correct ending of API paths

◆ checkApiFolders()

boolean checkApiFolders ( )
protected

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()

abstract ApiError doApiInit ( )
abstractprotected

do the concreate initialization call for the SDK here

Returns
errocode of init process

Reimplemented in ApiHelper.

◆ general()

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

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.

◆ getApplicationPath()

final String getApplicationPath ( )

◆ getAppVersion()

final String getAppVersion ( )

◆ getDeviceId() [1/2]

final String getDeviceId ( )

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)

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 ( )
Returns
information object of the current display

◆ getIMEI()

final String getIMEI ( )

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

◆ getLicense()

void getLicense ( )
protected

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

◆ getLocationManager()

IwLocationManager getLocationManager ( )
Returns
locationmanager to control the GPS functions

◆ getMapDataPath()

final String getMapDataPath ( )

◆ getPackageName()

final String getPackageName ( )

◆ getResourcePath()

final String getResourcePath ( )

◆ getSensorManager()

IwSensorManager getSensorManager ( )
Returns
sensormanager for orientation updates

◆ getSoundPath()

String getSoundPath ( )
Returns
sound path to speech files

◆ getTempPath()

final String getTempPath ( )

◆ getUserDataPath()

final String getUserDataPath ( )

◆ initPaths() [1/3]

void initPaths ( String  apiDirPath)

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 
)

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 
)

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)

◆ isApiInitialized()

final boolean isApiInitialized ( )

◆ isApiThreadAlive()

boolean isApiThreadAlive ( )
Returns
true if api thread is alive

◆ isCurrentThreadApiThread()

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

◆ licenceChanged()

void licenceChanged ( )

Called if changes in the list of licenced features occurs

Implements LicenceListener.

◆ licenceIsInvalid()

void licenceIsInvalid ( ApiError  error)

Called if the licence is invalid

Parameters
error- errorcode describing whay the licence is invalid

Implements LicenceListener.

◆ mapContent()

void mapContent ( Iterable< MapContent mapContentList)

Retrieves a list of all possible map types

Implements ApiListener.

◆ onApiInitFinished()

void onApiInitFinished ( ApiError  retVal,
String  description 
)

extract result and redirect to apiListener

◆ queueApiCall() [1/2]

boolean queueApiCall ( ApiTask  task)

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)

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)

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)

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)

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)

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)

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

Parameters
listenerto remove

◆ removeInitListener()

void removeInitListener ( ApiInitListener  listener)

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)

remove a listener for licence info

Parameters
listenerto remove

◆ setApiInitialized()

void setApiInitialized ( boolean  isInitialized)
protected

◆ setLocationManager()

void setLocationManager ( IwLocationManager  newLocationManager)

Stop current location manager and use the new one

Parameters
newLocationManager- new locationmanager to set

◆ setSensorManager()

void setSensorManager ( IwSensorManager  newSensorManager)

Stop current sensor manager and use the new one

Parameters
newSensorManager- new snsormanager to use

◆ setSoundPath()

void setSoundPath ( String  path)

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

Parameters
pathto the speech files

◆ startApiThread()

void startApiThread ( )
protected

start the thread that runs the API

◆ stopApiThread()

void stopApiThread ( )
protected

Stop the ApiThread and null its instance

◆ storeContextInfosForNativeAPI()

void storeContextInfosForNativeAPI ( Context  context)
protected

◆ uninitialize() [1/2]

void uninitialize ( )

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)
protected

if API thread running, we can uninit

Noify listener

◆ uninitLocationAndSensorManager()

void uninitLocationAndSensorManager ( )
protected

Stop location updates and deactivate manangers

Member Data Documentation

◆ apiAppPath

String apiAppPath
protected

Paths for API

◆ apiDataPath

String apiDataPath
protected

◆ apiListenerList

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

Register as API Listener and redirect callbacks to multiple clients

◆ apiMapservicexml

String apiMapservicexml
protected

◆ apiOsUserDataPath

String apiOsUserDataPath
protected

◆ apiResourcePath

String apiResourcePath
protected

◆ apiTempPath

String apiTempPath
protected

◆ apiThread

IwApiThread apiThread = null
protected

Api Thread. Started on API initialize call

◆ appVersion

String appVersion = ""
protected

◆ deviceId

String deviceId = ""
protected

Device infos for native API part

◆ imei

String imei = ""
protected

IMEI of device if available

◆ initListenerList

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

Register as API Init Listener and redirect callbacks to multile clients

◆ licenseListenerList

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

Register as API Licence Listener

◆ listenerMutex

Object listenerMutex = new Object()
protected

◆ locationManager

IwLocationManager locationManager
protected

location and orientation updates

◆ packageName

String packageName = ""
protected

◆ sensorManager

IwSensorManager sensorManager
protected

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