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 Detail

      • createExternalStorageDownloadHandler

        static UnbluDownloadHandler createExternalStorageDownloadHandler​(android.app.Application application)
        Creates a default implementation of UnbluDownloadHandler 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 the DownloadListener of WebViews.

        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 activity
        requestedUrl - The full url to the content that should be downloaded
        userAgent - 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
      • 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.