Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
//download to local fileval file = File.createTempFile("dowloadBigMedia", ".jpg")//get download taskval downloadTask = smh.download(//file name to downloadname = "uploadBigMedia.jpg",//Folder location, root directory is selected by defaultdir = Directory(),//download to local file pathlocalFullPath = file.absolutePath,//status listenerstateListener = object : SMHStateListener {override fun onStateChange(request: SMHRequest, state: SMHTransferState) {Log.i("testDownloadTask", "onStateChange $state")}},//progress listenerprogressListener = object: SMHProgressListener {override fun onProgressChange(request: SMHRequest, progress: Long, target: Long) {Log.i("testDownloadTask", "Progress change $progress/$target")}},//result listenerresultListener = object: SMHResultListener {override fun onSuccess(request: SMHRequest, result: SMHResult) {Log.i("testDownloadTask", "onSuccess")//download resultif(result is DownloadFileResult){Log.i("testDownloadTask", "bytesTotal: ${result.bytesTotal}")Log.i("testDownloadTask", "content: ${result.content.toString()}")Log.i("testDownloadTask", "crc64: ${result.crc64}")Log.i("testDownloadTask", "key: ${result.key}")Log.i("testDownloadTask", "meta: ${result.meta?.entries?.joinToString()}")}}override fun onFailure(request: SMHRequest,smhException: SMHException?,smhClientException: SMHClientException?) {Log.i("testDownloadTask", "onFailure $smhException, $smhClientException")}})launch {delay(5000)//suspend download taskdownloadTask.pause()}//start the download taskdownloadTask.start()delay(2000)//resume download taskdownloadTask.resume()
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan