I am developing an application to download files online, save them on internal storage, and read them once installed. Moreover, my client have requested than the files are encrypted.
Actually I have developed a working version that do the following :
Download process : 1) Download the File on internal storage 2) create a new encrypted file from the original one, and save it in the internal folder 3) Delete the original one
Opening process : 1) Create a Decrypted file from the encrypted one and save it in the internal storage 2) Open the decrypted file with the correct viewer 3) Delete the decrypted file once the user stop reading it.
Here is my question: I am actually using activityForResult and an Intent ACTION VIEW to open the decrypted file from the internal storage. First of All, I don't like using an ActivityForResult on an ACTION VIEW Intent because it is handled by a external app, Secondly the user keep the decrypted file if he leave the app from the viewer.
How Can I Create a temporary file from my decrypted file which will be destroy after the user finish reading it?
The downloaded files needs to be readable offline, so streaming is not an option.