miniapp / com.rakuten.tech.mobile.miniapp.navigator / MiniAppDownloadNavigator / onFileDownloadStart

onFileDownloadStart

abstract fun onFileDownloadStart(url: String, userAgent: String, contentDisposition: String, mimetype: String, contentLength: Long): Unit

Notify the host application that a file should be downloaded.

Note that this will only receive requests When the mini app downloaded a file via JavaScript XHR. In this case the url received here will be a base64 data string which you must decode to bytes.

In the case that a mini app wants to download a file from an external URL such as https://www.example.com/test.zip, the request will be sent to MiniAppNavigator.openExternalUrl, so you should handle this case in your custom WebView instance using WebView.setDownloadListener.

Parameters

url - 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

contentLength - The file size reported by the server