public class OfflineRegion
extends java.lang.Object
OfflineManager.CreateOfflineRegionCallback
to create a new offline region.Modifier and Type | Class | Description |
---|---|---|
static interface |
OfflineRegion.DownloadState |
A region is either inactive (not downloading, but previously-downloaded
resources are available for use), or active (resources are being downloaded
or will be downloaded, if necessary, when network access is available).
|
static interface |
OfflineRegion.OfflineRegionDeleteCallback |
This callback receives an asynchronous response containing a notification when
an offline region has been deleted, or a
String error message otherwise. |
static interface |
OfflineRegion.OfflineRegionInvalidateCallback |
This callback receives an asynchronous response containing a notification when
an offline region has been invalidated, or a
String error message otherwise. |
static interface |
OfflineRegion.OfflineRegionObserver |
A region can have a single observer, which gets notified whenever a change
to the region's status occurs.
|
static interface |
OfflineRegion.OfflineRegionStatusCallback |
This callback receives an asynchronous response containing the OfflineRegionStatus
of the offline region, or a
String error message otherwise. |
static interface |
OfflineRegion.OfflineRegionUpdateMetadataCallback |
This callback receives an asynchronous response containing the newly update
OfflineMetadata in the database, or an error message otherwise.
|
Modifier and Type | Field | Description |
---|---|---|
static int |
STATE_ACTIVE |
|
static int |
STATE_INACTIVE |
Modifier and Type | Method | Description |
---|---|---|
void |
delete(OfflineRegion.OfflineRegionDeleteCallback callback) |
Remove an offline region from the database and perform any resources evictions
necessary as a result.
|
protected void |
finalize() |
|
OfflineRegionDefinition |
getDefinition() |
|
long |
getID() |
|
byte[] |
getMetadata() |
|
void |
getStatus(OfflineRegion.OfflineRegionStatusCallback callback) |
Retrieve the current status of the region.
|
void |
invalidate(OfflineRegion.OfflineRegionInvalidateCallback callback) |
Invalidate all the tiles from an offline region forcing TrimbleMaps GL to revalidate
the tiles with the server before using.
|
boolean |
isDeliveringInactiveMessages() |
Gets whether or not the `OfflineRegionObserver` will continue to deliver messages even if
the region state has been set as STATE_INACTIVE.
|
void |
setDeliverInactiveMessages(boolean deliverInactiveMessages) |
When set true, the `OfflineRegionObserver` will continue to deliver messages even if
the region state has been set as STATE_INACTIVE (operations happen asynchronously).
|
void |
setDownloadState(int state) |
Pause or resume downloading of regional resources.
|
void |
setObserver(OfflineRegion.OfflineRegionObserver observer) |
Register an observer to be notified when the state of the region changes.
|
void |
updateMetadata(byte[] bytes,
OfflineRegion.OfflineRegionUpdateMetadataCallback callback) |
Update an offline region metadata from the database.
|
public static final int STATE_INACTIVE
public static final int STATE_ACTIVE
public boolean isDeliveringInactiveMessages()
public void setDeliverInactiveMessages(boolean deliverInactiveMessages)
deliverInactiveMessages
- true if it should deliver inactive messagespublic long getID()
public OfflineRegionDefinition getDefinition()
public byte[] getMetadata()
public void setObserver(@Nullable OfflineRegion.OfflineRegionObserver observer)
observer
- the observer to be notifiedpublic void setDownloadState(int state)
After a download has been completed, you are required to reset the state of the region to STATE_INACTIVE.
state
- the download statepublic void getStatus(@NonNull OfflineRegion.OfflineRegionStatusCallback callback)
callback
- the callback to invoked.public void delete(@NonNull OfflineRegion.OfflineRegionDeleteCallback callback)
Eviction works by removing the least-recently requested resources not also required by other regions, until the database shrinks below a certain size.
When the operation is complete or encounters an error, the given callback will be executed on the main thread.
Note that this operation can be potentially slow if packing the database occurs automatically (OfflineManager.runPackDatabaseAutomatically(boolean)
)
After you call this method, you may not call any additional methods on this object.
callback
- the callback to be invokedpublic void invalidate(@Nullable OfflineRegion.OfflineRegionInvalidateCallback callback)
callback
- the callback to be invokedpublic void updateMetadata(@NonNull byte[] bytes, @NonNull OfflineRegion.OfflineRegionUpdateMetadataCallback callback)
When the operation is complete or encounters an error, the given callback will be executed on the main thread.
bytes
- the metadata in bytescallback
- the callback to be invokedprotected void finalize()
finalize
in class java.lang.Object