Package-level declarations
Downloading files.
Downloader
The downloader is available from the DownloadManager interface
import com.cloudike.sdk.core.CoreManager
import com.cloudike.sdk.core.downloader.DownloadManager
val coreContext: CoreContext = coreManager.build(/* ... */)
val downloader: DownloadManager = coreContext.downloaderThe downloader provides
The ability to track the status
The ability to install a notification adapter
Downloading a file from a link
Canceling the download
The utilitarian methods
To download resources as part of background work, you need to use specialized methods.
Download Media
import com.cloudike.sdk.photos.PhotoManager
import com.cloudike.sdk.core.CoreManager
import com.cloudike.sdk.core.download.DownloadPriority
import com.cloudike.sdk.core.cache.CacheMode
val photoManager: PhotoManager
val targetDirUri: Uri
photoManager.timeline.enqueueToDownload(
mediaIds = setOf(1L, 2L, 3L),
priority = DownloadPriority.REGULAR,
cacheMode = CacheMode.TEMPORARY,
targetDirUri = targetDirUri
)Download File
import com.cloudike.sdk.files.FileManager
import com.cloudike.sdk.core.CoreManager
import com.cloudike.sdk.core.download.DownloadPriority
import com.cloudike.sdk.core.cache.CacheMode
val fileManager: FileManager
val targetDirUri: Uri
fileManager.operations.enqueueToDownload(
fileIds = setOf("1", "2", "3"),
priority = DownloadPriority.REGULAR,
cacheMode = CacheMode.TEMPORARY,
targetDirUri = targetDirUri
)Download Document
import com.cloudike.sdk.documentwallet.DocumentWalletManager
import com.cloudike.sdk.documentwallet.document.data.DocumentSize
import com.cloudike.sdk.core.CoreManager
import com.cloudike.sdk.core.download.DownloadPriority
import com.cloudike.sdk.core.cache.CacheMode
val dwManager: DocumentWalletManager
val targetDirUri: Uri
dwManager.documentManager.enqueueToDownload(
documentId = "",
size = DocumentSize.FULL,
priority = DownloadPriority.REGULAR,
cacheMode = CacheMode.TEMPORARY,
targetDirUri = targetDirUri
)Priority And Cache
The downloader has priority and cache parameters.
Priority
HIGH
REGULAR
Cache Mode
TEMPORARY - The cache is stored for 30 days.
OFFLINE - The cache is kept indefinitely. It`s not deleted during cleaning.
Types
A set of factors representing the state of the downloader and the reasons why the download might be stopped.
An interface to implement an adapter that translates the downloading state into a notification. The downloader uses it to display notifications during boot.
During the download process, the media file may change its download state.
A data model describing the downloader status.