Interface OfflineCacheManager
- Summary
- Methods
- regions
- allowUseCellularNetwork
- addRegionListUpdatesListener
- removeRegionListUpdatesListener
- addErrorListener
- removeErrorListener
- addRegionListener
- removeRegionListener
- getCities
- getState
- getDownloadedReleaseTime
- getProgress
- startDownload
- stopDownload
- pauseDownload
- drop
- mayBeOutOfAvailableSpace
- isLegacyPath
- computeCacheSize
- requestPath
- moveData
- setCachePath
- enableAutoUpdate
- clear
- requestRegionsAtPoint
- isValid
Package com.yandex.mapkit.offline_cache
interface OfflineCacheManager
Offline cache manager.
Примечание
This feature is not available in the free MapKit version.
Summary
Methods
Type and modifiers |
Method and Description |
java.util.List<Region> |
regions() |
void |
allowUseCellularNetwork(boolean useCellular) |
void |
addRegionListUpdatesListener(@NonNull RegionListUpdatesListener regionListUpdatesListener) The class does not retain the object in the 'regionListUpdatesListener' parameter. |
void |
removeRegionListUpdatesListener(@NonNull RegionListUpdatesListener regionListUpdatesListener) |
void |
addErrorListener(@NonNull ErrorListener errorListener) The class does not retain the object in the 'errorListener' parameter. |
void |
removeErrorListener(@NonNull ErrorListener errorListener) |
void |
addRegionListener(@NonNull RegionListener regionListener) The class does not retain the object in the 'regionListener' parameter. |
void |
removeRegionListener(@NonNull RegionListener regionListener) |
java.util.List<java.lang.String> |
getCities(int regionId) |
getState(int regionId) |
|
java.lang.Long |
getDownloadedReleaseTime(int regionId) |
float |
getProgress(int regionId) |
void |
startDownload(int regionId) |
void |
stopDownload(int regionId) |
void |
pauseDownload(int regionId) |
void |
drop(int regionId) |
boolean |
mayBeOutOfAvailableSpace(int regionId) |
boolean |
isLegacyPath(int regionId) |
void |
computeCacheSize(@NonNull SizeListener callback) |
void |
requestPath(@NonNull PathGetterListener callback) |
void |
moveData(@NonNull java.lang.String newPath, |
void |
setCachePath(@NonNull java.lang.String path, |
void |
enableAutoUpdate(boolean enable) |
void |
clear(@NonNull ClearListener callback) |
void |
requestRegionsAtPoint(@NonNull Point point, |
boolean |
isValid() |
Methods
regions
@NonNull |
Copying a list of regions from memory.
All changes of regions won't affected on on the collection.
allowUseCellularNetwork
void allowUseCellularNetwork(boolean useCellular) |
Indicates whether to allow downloading using cellular networks (3G, LTE, and other).
Disallowed by default.
addRegionListUpdatesListener
void addRegionListUpdatesListener(@NonNull RegionListUpdatesListener regionListUpdatesListener) |
Subscribe on update of region list
The class does not retain the object in the 'regionListUpdatesListener' parameter.
It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeRegionListUpdatesListener
void removeRegionListUpdatesListener(@NonNull RegionListUpdatesListener regionListUpdatesListener) |
Unsubscribe from region list update
addErrorListener
void addErrorListener(@NonNull ErrorListener errorListener) |
Subscribe on errors
The class does not retain the object in the 'errorListener' parameter.
It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeErrorListener
void removeErrorListener(@NonNull ErrorListener errorListener) |
Unsubscribe from errors
addRegionListener
void addRegionListener(@NonNull RegionListener regionListener) |
Subscribe on status events
The class does not retain the object in the 'regionListener' parameter.
It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeRegionListener
void removeRegionListener(@NonNull RegionListener regionListener) |
Unsubscribe from status events
getCities
@NonNull |
Returns a list of cities.
getState
@NonNull |
Current region state
getDownloadedReleaseTime
@Nullable |
Release time of downloaded region files
getProgress
float getProgress(int regionId) |
Current region progress [0,1].
For downloaded files returns 1; If we haven't start download yet, returns 0;
startDownload
void startDownload(int regionId) |
Start to download new offline cache for the region or update if region has been downloaded
stopDownload
void stopDownload(int regionId) |
Stop downloading of region
pauseDownload
void pauseDownload(int regionId) |
Pause downloading of region
drop
void drop(int regionId) |
Drop region data from the device.
If data is being downloaded then downloading is cancelled.
mayBeOutOfAvailableSpace
boolean mayBeOutOfAvailableSpace(int regionId) |
Returns true if available disk space might not be enough for installation of the region data.
isLegacyPath
boolean isLegacyPath(int regionId) |
Returns true if region has files with legacy localized path.
If region in downloading state result may be incorrect.
computeCacheSize
void computeCacheSize(@NonNull SizeListener callback) |
Calculates the full cache size in bytes.
requestPath
void requestPath(@NonNull PathGetterListener callback) |
Provides the data path for offline cache files.
moveData
void moveData(@NonNull java.lang.String newPath, |
Moves offline caches to the specified folder.
This operation is non-cancellable. If there is already a pending operation to set the cache path, it throws an error (Android). If the application exits before the operation is completed, it does not take effect, but garbage will not be cleared.
The class does not retain the object in the 'dataMoveListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
Parameters |
|
|
New path to store data. |
|
It will be unsubscribed automatically when the operation is completed or fails with an error. |
setCachePath
void setCachePath(@NonNull java.lang.String path, |
Sets a new path for caches.
If the specified path contains an existing cache, this cache will be used; otherwise, a new cache will be initialized.
enableAutoUpdate
void enableAutoUpdate(boolean enable) |
Enables autoupdating downloaded caches when they become outdated.
clear
void clear(@NonNull ClearListener callback) |
Erases all data for downloads and regions and wipes the cache.
Forces reloading the list from the remote source
requestRegionsAtPoint
void requestRegionsAtPoint(@NonNull Point point, |
Provides ids of regions containing specified point.
Some of the returned regions may not be available in current regions list.
isValid
boolean isValid() |
Tells if this OfflineCacheManager is valid or not.
Any other method (except for this one) called on an invalid OfflineCacheManager will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.