8. Download Events/Callbacks
This document is a machine-translated draft and is currently undergoing review. Some content may be inaccurate or differ from the original Korean version. For the most precise information, refer to the Korean documentation.
This document explains how to integrate callback interfaces that notify the application layer of traffic state changes and DRM validation events occurring during download pipeline execution. The SDK provides two main types of listener callback interfaces based on their roles.
Download progress event listener
Implement MultiKollusStorageListener to track the background file reception progress and completion/failure status.
Each callback method is delivered along with the latest KollusContent object source that reflects state changes in real time.
Real-time progress information can be obtained directly via the content.getDownloadPercent() property of the received object, or by calculating content.getReceivingSize() / content.getFileSize().
public interface MultiKollusStorageListener {
void onComplete(KollusStorage storage, KollusContent content);
void onProgress(KollusStorage storage, KollusContent content);
void onError(KollusStorage storage, KollusContent content, int nErrorCode);
}
DRM event listener
Implement MultiKollusPlayerDRMListener to receive DRM validation results and expiration events.
public interface MultiKollusPlayerDRMListener {
int DCB_INFO_DELETE = 0; // Force deletion of content due to kind2 or kind3 response
int DCB_INFO_EXPIRED = 1; // Force expiration due to kind3 response
int DCB_INFO_RESET = 2; // Content reset due to kind3 response
void onDRM(KollusStorage storage, String request, String response);
void onDRMInfo(KollusStorage storage, KollusContent content, int nInfoCode);
}
For detailed specifications of kind1, kind2, kind3 bound to the branching conditions inside the callback, refer to the DRM Download Callback document.
Event-callback mapping table
| Standard event | Actual callback location |
|---|---|
| Download started | Immediately after the storage.download(mck) method returns 0 or greater |
| Progress changed | MultiKollusStorageListener.onProgress(storage, content) |
| Download paused | No dedicated callback (same as cancel) |
| Download resumed | No dedicated callback (same as start) |
| Download completed | MultiKollusStorageListener.onComplete(storage, content) |
| Download failed | MultiKollusStorageListener.onError(storage, content, errorCode) |
| License expired | MultiKollusPlayerDRMListener.onDRMInfo(storage, content, DCB_INFO_EXPIRED) |
| License renewal result | KollusPlayerDRMUpdateListener passed when calling updateDownloadDRMInfo |
Register and unregister listener callbacks
Listeners must be registered and unregistered in accordance with the Android component (Activity/Service) lifecycle.
@Override
protected void onCreate(...) {
...
multiStorage.registerKollusStorageListener(mStorageListener);
multiStorage.registerKollusPlayerDRMListener(mDRMListener);
}
@Override
protected void onDestroy() {
multiStorage.unregisterKollusStorageListener(mStorageListener);
multiStorage.unregisterKollusPlayerDRMListener(mDRMListener);
...
}