Take pictures > save the pictures >upload it to api > delete works like recycler>

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Take pictures > save the pictures >upload it to api > delete works like recycler>



I'm currently working on an Android app where, App converts the picture to scanned document format.



*****My requirement is to save those pictures at some place, As these pictures will be uploaded to an api, after these pictures are successfully uploaded to api uploaded pictures need to be deleted *****



I don't understand where to start,



Any suggestions sample code/ any new idea is really appreciated





...successfully uploaded to API "these" need to be deleted , what do you mean by these?
– Shashank Mishra
Aug 10 at 15:20



...successfully uploaded to API "these" need to be deleted





I don't know why do you think that but Local Storage is definitely faster and more reliable compared to storing it to any server.
– Shashank Mishra
Aug 10 at 15:23





Try this link for local storage tutorial
– Shashank Mishra
Aug 10 at 15:25





These means> The uploaded files need to be deleted. when the network is onPostExecute > delete the pictures which are uploaded...
– Akhila
Aug 10 at 15:39





Which local store do I need to use, can you please suggest me? Internal/ extrenal/ DB/ shared preferences. I tried with DB, It was very hard to delete the images from google photos. Internal storage /External storage i have tried but no idea how to use them for pictures, I did stored them by files but retrieval back is taking time. If you can provide me the source code of usage i would test the time taken and will be able to judge based on it. Thank you
– Akhila
Aug 10 at 16:21




2 Answers
2



I don't understand why the internal file storage is slow just save it to:


Context.getFilesDir().getAbsolutePath() + "/" + [filename]



Then you can create a file object from that path and delete it by writing:


Files.deleteIfExists(path)





Can you please provide me a source code where i can check the usage ? I really don't understand by the bits of code, I would really appreciate your help.
– Akhila
Aug 10 at 15:42





I think i wasn't clear enough with my answer. With the first line of code you get a path in form of a string to which you can safely read and write. I don't know how you are taking a picture but you can safe it there. Then you can upload this file and after succes you just delete it with the second part of the code.
– Epig
Aug 11 at 19:58



I would recommend using Cloudinary to save your images, his api is very complete.


Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap(
"cloud_name", "your_cloud_name", "api_key", "your_api_key", "api_secret", "your_api_key"));
cloudinary.uploader().upload("sample.jpg", ObjectUtils.emptyMap());



You can find more information about your documentation here.



I hope I've helped!





Thank you, I'll try it out and let you know.
– Akhila
Aug 10 at 16:23






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard