Class TrimbleMaps

java.lang.Object
com.trimblemaps.mapsdk.TrimbleMaps

@UiThread public final class TrimbleMaps extends Object
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 Details

    • getInstance

      @UiThread @NonNull public static TrimbleMaps getInstance(@NonNull android.content.Context context)
      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 context
      account - TrimbleMaps account
      tileServer - 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

      @Nullable public static TileServerOptions getTileServerOptions()
      Get tile server configuration.
    • getPredefinedStyles

      @Nullable public static DefaultStyle[] getPredefinedStyles()
      Get all pre-defined styles
      Returns:
      Array of predefined styles
    • getPredefinedStyle

      @Nullable public static DefaultStyle getPredefinedStyle(String name)
      Get predefined style by name
      Returns:
      Predefined style if found
    • getRegion

      @Nullable public static String getRegion()
    • getApplicationContext

      @NonNull public static android.content.Context getApplicationContext()
      Application context
      Returns:
      the application context
    • setConnected

      public static void setConnected(Boolean connected)
      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

      public static Boolean 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

      @NonNull public static ModuleProvider getModuleProvider()
      Get the module provider
      Returns:
      moduleProvider
    • setModuleProvider

      public static void setModuleProvider(ModuleProvider provider)
      Set the module provider. Call this as soon as possible.
      Parameters:
      provider - The ModuleProvider instance to set
    • throwIfApiKeyInvalid

      public static void throwIfApiKeyInvalid(@Nullable String apiKey)
      Throws exception when access token is invalid
    • hasInstance

      public static boolean hasInstance()
      Internal use. Check if the INSTANCE is present.