WebkitDownloadListener
WebkitDownloadListener
Events:
- FileDownloadCompleted (Success As Boolean, DownloadProperties1 As WebkitDownloadProperties) 'Works from API level 9 and above.
- FileDownloadInitialized (DownloadProperties1 As WebkitDownloadProperties) 'Works from API level 1 and above.
- FileDownloadStarted (DownloadProperties1 As WebkitDownloadProperties) 'Works from API level 9 and above.
Functions:
- Initialize (Callback As Object, EventName As String, WebView1 As WebView, Enabled As Boolean) As String
Initializes the new instance of android.webkit.DownloadListener as WebkitDownloadListener for B4A.
WebWiew1 As WebView - Pass WebView into which the WebkitDownloadListener will be integrated, or pass Null if you just want to initialize the WebkitDownloadListener that you will integrate manually by calling ToObject method. If you pass Null, Enabled property will have no effect and will always be False.
Enabled as Boolean - Pass True to start WebkitDownloadListener immediately or pass False if you want to start it later. You can change Enabled state throught WebkitDownloadListener.Enabled property.
- StartFileDownload (DownloadProperties1 As WebkitDownloadProperties, DownloadManagerDescription As String, AllowScanningByMediaScanner As Boolean, DownloadManagerNotification As Boolean) As String
Use this method to start the file download. This method can only be used in the FileDownloadInitialized event. To download the file, the Android DownloadManager will be used and the downloaded file will be placed in the Download folder.
- ToObject As Object
Convert WebkitDownloadListener to android.webkit.DownloadListener which can be used in inline Java code.
- IsInitialized As Boolean
Tests whether the object has been initialized.
Properties:
- Enabled As Boolean
Gets or sets WebkitDownloadListener Enabled state.
True - Start Listening for downloads.
False - Stop Listening for downloads.
WebkitDownloadProperties
Fields:
- ContentDisposition As String
- ContentLength As Long
- Cookies As String
- DownloadID As Long
- FileExtension As String
- FileName As String
- IsInitialized As Boolean
Tests whether the object has been initialized.
- MimeType As String
- Url As String
- UserAgent As String
Functions:
- Initialize
Initializes the fields to their default value.