I've got a Webview Android app with a download button that tries to download an image from an S3 bucket. Like a half year, ago everything worked fine but suddenly it stopped working. If i go to the browser variant of the website everything still works. So i think it has something to do with the app.
I have a addDownloadListener and I added in the android manifest.
Below is my addDownloadListener:
private void addDownloadListener() { TurbolinksSession.getDefault(this) .activity(this) .adapter(this) .view(turbolinksView) .getWebView() .setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimeType,
long contentLength) {
String filename = URLUtil.guessFileName(url, contentDisposition, mimeType);
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
Toast.makeText(getApplicationContext(), "Download is gestart", //To notify the Client that the file is being downloaded
Toast.LENGTH_LONG).show();
}
});
}
When i click the link this is the output in the log cat:
E: [] mConsumerName == NULL!!!!!! 2019-05-10 11:00:53.606 ? E: onTransact in code is: 103
2019-05-10 10:45:51.840 ? E: win=Window{104d4cf u0 com.app.name.here.MainActivity} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false