Package com.unblu.sdk.core.configuration
Interface UnbluDownloadHandler
-
public interface UnbluDownloadHandler
Handler for downloads. The download handler has to effectively download the file and store it at some location. Everything related to the download has to be done by this handler (e.g. permission handling for storing).
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static UnbluDownloadHandler
createExternalStorageDownloadHandler(android.app.Application application)
Creates a default implementation ofUnbluDownloadHandler
which stores the files in the public downloads directory.void
onDownloadStart(com.unblu.sdk.core.internal.utils.IApplicationStateProvider applicationStateProvider, java.lang.String requestedUrl, java.lang.String userAgent, java.lang.String contentDisposition, java.lang.String mimeType, long contentLength, java.lang.String cookies)
Triggered whenever a download is started.default void
onDownloadStart(com.unblu.sdk.core.internal.utils.IApplicationStateProvider applicationStateProvider, java.lang.String requestedUrl, java.lang.String userAgent, java.lang.String contentDisposition, java.lang.String mimeType, long contentLength, java.lang.String cookies, java.lang.String oAuthToken)
Triggered whenever a download is started.default void
onWebViewDestroy()
Called whenever the webView is destroyed.default void
onWebViewInitialize()
Called whenever the webView is initialized.
-
-
-
Method Detail
-
createExternalStorageDownloadHandler
static UnbluDownloadHandler createExternalStorageDownloadHandler(android.app.Application application)
Creates a default implementation ofUnbluDownloadHandler
which stores the files in the public downloads directory.- Parameters:
application
- The application instance- Returns:
- The default implementation using
SharedPreferences
-
onDownloadStart
void onDownloadStart(com.unblu.sdk.core.internal.utils.IApplicationStateProvider applicationStateProvider, java.lang.String requestedUrl, java.lang.String userAgent, java.lang.String contentDisposition, java.lang.String mimeType, long contentLength, java.lang.String cookies)
Triggered whenever a download is started. Except for the cookies, this matches theDownloadListener
ofWebView
s.MimeType and content disposition are may not present and an additional HEAD request has do be done to retrieve those information from the server.
- Parameters:
applicationStateProvider
- The applicationStateProvider to check for the active activityrequestedUrl
- The full url to the content that should be downloadeduserAgent
- the user agent to be used for the download.contentDisposition
- Content-disposition http header, if present.mimeType
- The mimeType of the content reported by the server.cookies
- The cookies used inside the WebView which are relevant for this request. They may have to be added to the request to have access to the file.contentLength
- Content-Length
-
onDownloadStart
default void onDownloadStart(com.unblu.sdk.core.internal.utils.IApplicationStateProvider applicationStateProvider, java.lang.String requestedUrl, java.lang.String userAgent, java.lang.String contentDisposition, java.lang.String mimeType, long contentLength, java.lang.String cookies, java.lang.String oAuthToken)
Triggered whenever a download is started. Except for the cookies, this matches theDownloadListener
ofWebView
s.MimeType and content disposition are may not present and an additional HEAD request has do be done to retrieve those information from the server.
- Parameters:
applicationStateProvider
- The applicationStateProvider to check for the active activityrequestedUrl
- The full url to the content that should be downloadeduserAgent
- the user agent to be used for the download.contentDisposition
- Content-disposition http header, if present.mimeType
- The mimeType of the content reported by the server.cookies
- The cookies used inside the WebView which are relevant for this request. They may have to be added to the request to have access to the file.contentLength
- Content-LengthoAuthToken
- optional oAuthToken,
-
onWebViewInitialize
default void onWebViewInitialize()
Called whenever the webView is initialized. This happens during the initialization of the SDK.
This can be used to do some initial setup.
-
onWebViewDestroy
default void onWebViewDestroy()
Called whenever the webView is destroyed. This happens when the SDK is deinitialized.
This can be used to do some cleanup.
-
-