Fetch
Fetch copied to clipboard
Unable to enque the request, throwing error always
showing this error
12-30 02:38:30.183 E/ActivityThread: Failed to find provider info for com.example.dporter.meterconfig.configcontentprovider
and this is code I'm using
` public void downloadThis(String url, final String fileName){ Dexter.withContext(this) .withPermissions( Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE) .withListener(new MultiplePermissionsListener() { @Override public void onPermissionsChecked(MultiplePermissionsReport report) { if (report.areAllPermissionsGranted()) {
String file = "/downloads/"+fileName;
com.tonyodev.fetch2.Request request = new com.tonyodev.fetch2.Request(url, file);
request.setPriority(Priority.HIGH);
request.setNetworkType(NetworkType.ALL);
fetch.enqueue(request, updatedRequest ->{
getWebview(true).evaluateJavascript(
"(function(){return document.body.textContent;})();",
html -> {
if (html.equals("\"\"")){
onBackPressed();
}
});
Toasty.success(getBaseContext(), "Download started.", 1000).show();
},
error ->{
Toasty.error(getBaseContext(), "Error starting download.", 1000).show();
Log.d("Downloaderror", error.toString());
});
}
// check for permanent denial of any permission
if (report.isAnyPermissionPermanentlyDenied()) {
// show alert dialog navigating to Settings
showSettingsDialog();
}
}
@Override
public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
token.continuePermissionRequest();
}
}).
withErrorListener(error -> Toast.makeText(getApplicationContext(), "Error occurred in permissions! ", Toast.LENGTH_SHORT).show())
.onSameThread()
.check();
}
`
@toppersdesk This error is not related to Fetch but to a ContentProvider.