Class FileSource

java.lang.Object
com.trimblemaps.mapsdk.storage.FileSource

public class FileSource extends Object
Holds a central reference to the core's DefaultFileSource for as long as there are active mapviews / offline managers
  • Method Details

    • getInstance

      @UiThread public static FileSource getInstance(@NonNull android.content.Context context)
      Get the single instance of FileSource.
      Parameters:
      context - the context to derive the cache path from
      Returns:
      the single instance of FileSource
    • isExternalStorageReadable

      public static boolean isExternalStorageReadable()
      Checks if external storage is available to at least read. In order for this to work, make sure you include <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> (or WRITE_EXTERNAL_STORAGE) for API level < 18 in your app Manifest.

      Code from https://developer.android.com/guide/topics/data/data-storage.html#filesExternal

      Returns:
      true if external storage is readable
    • initializeFileDirsPaths

      @UiThread public static void initializeFileDirsPaths(android.content.Context context)
      Initializes file directories paths.
      Parameters:
      context - the context to derive paths from
    • getResourcesCachePath

      @NonNull public static String getResourcesCachePath(@NonNull android.content.Context context)
      Get files directory path for a context.
      Parameters:
      context - the context to derive the files directory path from
      Returns:
      the files directory path
    • getInternalCachePath

      public static String getInternalCachePath(@NonNull android.content.Context context)
      Get internal cache path for a context.
      Parameters:
      context - the context to derive the internal cache path from
      Returns:
      the internal cache path
    • setResourcesCachePath

      @Deprecated public static void setResourcesCachePath(@NonNull android.content.Context context, @NonNull String path, @NonNull FileSource.ResourcesCachePathChangeCallback callback)
      Changes the path of the resources cache database.

      The callback reference is strongly kept throughout the process, so it needs to be wrapped in a weak reference or released on the client side if necessary.

      Parameters:
      context - the context of the path
      path - the new database path
      callback - the callback to obtain the result
    • setResourcesCachePath

      public static void setResourcesCachePath(@NonNull String path, @NonNull FileSource.ResourcesCachePathChangeCallback callback)
      Changes the path of the resources cache database.

      The callback reference is strongly kept throughout the process, so it needs to be wrapped in a weak reference or released on the client side if necessary.

      Parameters:
      path - the new database path
      callback - the callback to obtain the result
    • setApiBaseUrl

      public void setApiBaseUrl(int environment)
    • setTileServerOptions

      public void setTileServerOptions(TileServerOptions tileServerOptions)
    • isActivated

      public boolean isActivated()
    • activate

      public void activate()
    • deactivate

      public void deactivate()
    • setApiKey

      public void setApiKey(String apiKey)
    • getApiKey

      @NonNull public String getApiKey()
    • setApiBaseUrl

      public void setApiBaseUrl(String baseUrl)
    • getApiBaseUrl

      @NonNull public String getApiBaseUrl()
    • setRegion

      public void setRegion(String region)
    • getRegion

      @NonNull public String getRegion()
    • setResourceTransform

      public void setResourceTransform(FileSource.ResourceTransformCallback callback)
      Sets a callback for transforming URLs requested from the internet

      The callback will be executed on the main thread once for every requested URL.

      Parameters:
      callback - the callback to be invoked or null to reset
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable