RiskForDream adlı üyeden alıntı: mesajı görüntüle
activity aşağıdaki kod ile bi download lister ekle
mWebView.setDownloadListener(new DownloadListener() {

@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url)); request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "indirilen dosya adını buraya yaz");
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); dm.enqueue(request); Toast.makeText(getApplicationContext(), "İndirme başladı",
Toast.LENGTH_LONG).show();
}
});
son olarak manifestte dosya yazma iznini ekle
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Hocam sağolun



Uhud adlı üyeden alıntı: mesajı görüntüle
AndroidManifest Dosyana şunları da ekle

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Sonrasında kullanıcılardan izin almazsan uygulama durdu hatası alacaksın. Bunun içinde, aşağıdaki gibi izin aldır.
Activity içerisinde bu kodları kullanmalısın. Eğer READ_EXTERNAL_STORAGE kısmı kırmızı verirse Manifest.permission olarak atama yaparsın.
if ((ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) || (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)) {
if ((ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)))
{

}
else
{
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE},REQUEST_PERMISSIONS);
}
}

}
hocam çok sağolun



RiskForDream adlı üyeden alıntı: mesajı görüntüle
activity aşağıdaki kod ile bi download lister ekle
mWebView.setDownloadListener(new DownloadListener() {

@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url)); request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "indirilen dosya adını buraya yaz");
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); dm.enqueue(request); Toast.makeText(getApplicationContext(), "İndirme başladı",
Toast.LENGTH_LONG).show();
}
});
son olarak manifestte dosya yazma iznini ekle
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
mWebView.setDownloadListener(new DownloadListener()
da sorun yaşıyorum, kütüphaneyemi eklemeliyim