Image Downloading, BlobNotFound. This blob not found for this app backend
A
Aarti Borate
started a topic
7 months ago
In an android app,I am trying to download 1 image which is stored in Kinvey backend (not uploading though). But if I try to fetch that image, it is giving , com.kinvey.java.core.KinveyJsonResponseException: BlobNotFound this exception. As I can see in my storage path of device, image is corrupted. Below is the code I've used for downloading a file,
private void checkImage(String imageId, final ImageView imageView) throws IOException { if (imageId == null) { return; } final File outputDirectory = new File(Environment.getExternalStorageDirectory() + Constants.IMAGE_DIRECTORY); if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } final File outputFile = new File(Environment.getExternalStorageDirectory() + Constants.IMAGE_DIRECTORY + "/" + imageId + Constants.IMAGE_EXTENSION); Log.i("TAG", "outputFile == " + outputFile); if (!outputFile.exists()) { outputFile.createNewFile(); } final FileOutputStream fos = new FileOutputStream(outputFile); FileMetaData fileMetaDataForDownload = new FileMetaData(imageId); App.getKinveyClient().file().download(fileMetaDataForDownload, fos, new DownloaderProgressListener() { @Override public void onSuccess(Void args) { try { fos.write(outputFile.getAbsolutePath().getBytes()); imageView.setImageBitmap(BitmapFactory.decodeFile(outputFile.getAbsolutePath())); //Toast.makeText(getApplication(), R.string.toast_successful, Toast.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } }
It would be great if anybody could tell me cause of this. Thank you in advance.
1 Comment
P
Pranav J
said
7 months ago
Aarti,
Do you see the file properly uploaded under “Files” in the Kinvey Console and its file_id?
Is the file id that you are passing to the download function correct? Can you verify that?
When viewing the File under "Kinvey Console=>Files”, when you click
on the “Download Link” does it open the file in the browser?
Aarti Borate
In an android app,I am trying to download 1 image which is stored in Kinvey backend (not uploading though). But if I try to fetch that image, it is giving , com.kinvey.java.core.KinveyJsonResponseException: BlobNotFound this exception. As I can see in my storage path of device, image is corrupted. Below is the code I've used for downloading a file,
});
It would be great if anybody could tell me cause of this. Thank you in advance.