Package com.trimblemaps.mapsdk
Class TrimbleMaps
java.lang.Object
com.trimblemaps.mapsdk.TrimbleMaps
The entry point to initialize the TrimbleMaps Android SDK.
Obtain a reference by calling . Usually this class is configured in Application#onCreate() and is responsible for the active API key, application context, and connectivity state.
-
Method Summary
Modifier and TypeMethodDescriptionstatic android.content.ContextApplication contextstatic TrimbleMapsgetInstance(android.content.Context context) Get an instance of TrimbleMaps.static TrimbleMapsgetInstance(android.content.Context context, com.trimblemaps.account.models.TrimbleMapsAccount account, WellKnownTileServer tileServer) Get an instance of TrimbleMaps.static ModuleProviderGet the module providerstatic DefaultStylegetPredefinedStyle(String name) Get predefined style by namestatic DefaultStyle[]Get all pre-defined stylesstatic Stringstatic TileServerOptionsGet tile server configuration.static booleanInternal use.static BooleanDetermines whether we have an internet connection available.static voidsetConnected(Boolean connected) Manually sets the connectivity state of the app.static voidsetModuleProvider(ModuleProvider provider) Set the module provider.static voidthrowIfApiKeyInvalid(String apiKey) Throws exception when access token is invalid
-
Method Details
-
getInstance
Get an instance of TrimbleMaps.This class manages the API key, application context, and connectivity state.
- Parameters:
context- Android context which holds or is an application context- Returns:
- the single instance of TrimbleMaps
-
getInstance
@UiThread @NonNull public static TrimbleMaps getInstance(@NonNull android.content.Context context, @NonNull com.trimblemaps.account.models.TrimbleMapsAccount account, WellKnownTileServer tileServer) Get an instance of TrimbleMaps.This class manages the account, application context, and connectivity state.
- Parameters:
context- Android context which holds or is an application contextaccount- TrimbleMaps accounttileServer- the tile server whose predefined configuration will be used to bootstrap the SDK. The predefined configuration includes rules for converting resource URLs between normal and canonical forms and set of predefined styles available on the server.- Returns:
- the single instance of TrimbleMaps
-
getTileServerOptions
Get tile server configuration. -
getPredefinedStyles
Get all pre-defined styles- Returns:
- Array of predefined styles
-
getPredefinedStyle
Get predefined style by name- Returns:
- Predefined style if found
-
getRegion
-
getApplicationContext
@NonNull public static android.content.Context getApplicationContext()Application context- Returns:
- the application context
-
setConnected
Manually sets the connectivity state of the app. This is useful for apps which control their own connectivity state and want to bypass any checks to the ConnectivityManager.- Parameters:
connected- flag to determine the connectivity state, true for connected, false for disconnected, and null for ConnectivityManager to determine.
-
isConnected
Determines whether we have an internet connection available. Please do not rely on this method in your apps. This method is used internally by the SDK.- Returns:
- true if there is an internet connection, false otherwise
-
getModuleProvider
Get the module provider- Returns:
- moduleProvider
-
setModuleProvider
Set the module provider. Call this as soon as possible.- Parameters:
provider- The ModuleProvider instance to set
-
throwIfApiKeyInvalid
Throws exception when access token is invalid -
hasInstance
public static boolean hasInstance()Internal use. Check if theINSTANCEis present.
-