Replacing a image (photo) in the device Gallery

Hey Gurus

Some business process has to save an image in the device gallery but have to keep only one ( latest one).

Any clues in order to identify this old image and replace for new one?

Best Regards

Hi Edgardo,

I assume you are using a table with the image information, and another table (where the ID is the ID from the previous table) that contains the binary?

You can add an attribute with a name like: createdAt (datetime type) and each time a new image is added you go to the table, and instead the datetime of all the newest ones, and delete them.

I don't know if this is what you were looking for? Hope this helps.

Regards,

Nuno Verdasca

Nuno

Thanks for your reply but I am not saving in table. I am saving direct to as image in the device.




Main idea is having only one image in the device...( again no table , no bitmap)


Any help?

Hi, Edgardo

I don't know if you can manage files directly in the device's gallery, like you are trying to do. However, you could make your own "gallery screen" to display the image you want to maintain. Storing it in a LocalEntity, you could work with it the way Nuno Verdasca described above, for example.

Regards,

Sam

Samuel

Thanks for your answer. Allow me to explain in detail. We are implementing a business logic which we generate a QR Code. Once this is generated then User can execute a bottom to share via What'up or any social media. In addition, They have option to save as picture in the device gallery. Challenge here is replace any existing photo with new one.

more clear?

Samuel, by the way I am pretty clear with storing LocalEntity and so on. Problem is User save as "regular" photo...


Hi, Edgardo

Like all downloads to device, you will store a new file everytime you save to gallery. If it has the same name, the native platform will just add a counter number in front of the existent name, like <repeated-file-name> (2).filetype.

I would approach this the following way: Display the lastest generated QR code somewhere in your app, tapping to save in the device's gallery as picture, from which you share to other apps. 

Let me know if this helps,

Sam

We are same page...But Client was to have only one picture ( latest one ) if not then They will have a lot of wasting device memory . Do you think it is possible?

Best Regards

Hi, Edgardo

From my understanding, downloading the files, removes them from the scope of your database, and as such out of your reach to delete to keep only the last downloaded image store. The user is obviously able to delete them manually in the device's gallery.

Regards,

Sam