Friday, January 24, 2020

Android Code Download From URL

Tags





Public Variabel


 DownloadManager downloadManager;

 

Perintah nya

 

btnDownload.setOnClickListener(new View.OnClickListener() {

 @Override  public void onClick(View arg0) {

 downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE)

 

 Uri uri= Uri.parse(ip+"ypathfile/"+dokumen)

 

 DownloadManager.Request request = new DownloadManager.Request(uri)

 

 request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

 

 Long reference = downloadManager.enqueue(request)

 

 Toast.makeText(getBaseContext(), "Download Berhasil...", Toast.LENGTH_LONG).show();        

 

 

}});

 




EmoticonEmoticon