Reputation: 41
I am using https://github.com/koush/ion in my app to download files from urls and write them to Android devices.
Most of the time it works great but from the statistics there are around 15% of my users getting null file from the call back (onCompleted)
This is part of the code I use.
File d = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File f = new File(d, 'some_file_name');
Ion.with(this).load('some_url')
.progress(new ProgressCallback() {
............
})
.write(f)
.setCallback(new FutureCallback<File>() {
@Override
public void onCompleted(Exception e, File file) {
....... file is null .....
}
});
Upvotes: 1
Views: 856
Reputation: 1760
In my case I had forgotten to check the Android M permissions, the manifest permission were not enough.
Upvotes: 0