Package com.trimblemaps.mapsdk.storage
Class FileSource
java.lang.Object
com.trimblemaps.mapsdk.storage.FileSource
Holds a central reference to the core's DefaultFileSource for as long as
there are active mapviews / offline managers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceThis callback receives an asynchronous response containing the new path of the resources cache database.static interfaceThis callback allows implementors to transform URLs before they are requested from the internet. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidprotected voidfinalize()static FileSourcegetInstance(android.content.Context context) Get the single instance of FileSource.static StringgetInternalCachePath(android.content.Context context) Get internal cache path for a context.static StringgetResourcesCachePath(android.content.Context context) Get files directory path for a context.static voidinitializeFileDirsPaths(android.content.Context context) Initializes file directories paths.booleanstatic booleanChecks if external storage is available to at least read.voidsetApiBaseUrl(int environment) voidsetApiBaseUrl(String baseUrl) voidvoidstatic voidsetResourcesCachePath(android.content.Context context, String path, FileSource.ResourcesCachePathChangeCallback callback) Deprecated.static voidsetResourcesCachePath(String path, FileSource.ResourcesCachePathChangeCallback callback) Changes the path of the resources cache database.voidSets a callback for transforming URLs requested from the internetvoidsetTileServerOptions(TileServerOptions tileServerOptions)
-
Method Details
-
getInstance
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
Get files directory path for a context.- Parameters:
context- the context to derive the files directory path from- Returns:
- the files directory path
-
getInternalCachePath
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) Deprecated.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 pathpath- the new database pathcallback- 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 pathcallback- the callback to obtain the result
-
setApiBaseUrl
public void setApiBaseUrl(int environment) -
setTileServerOptions
-
isActivated
public boolean isActivated() -
activate
public void activate() -
deactivate
public void deactivate() -
setApiKey
-
getApiKey
-
setApiBaseUrl
-
getApiBaseUrl
-
setRegion
-
getRegion
-
setResourceTransform
Sets a callback for transforming URLs requested from the internetThe 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
-
setResourcesCachePath(String, ResourcesCachePathChangeCallback)