I am using E2E encryption for sending files between Android devices.
Is there a way to download an encrypted file using the DownloadManager and immediately decrypt the file before saving it to the disk?
To my understanding, the only solution is to use BroadcastReceiver for detecting finished downloads. But that means that the app has to be open, and the user might get to a state where the download is complete but the file is corrupt because it was not yet decrypted.
Is there another way to decrypt the file completely in the background, without using a broadcast receiver?
Is there a way to download an encrypted file using the DownloadManager and immediately decrypt the file before saving it to the disk?
No. DownloadManager
will save to disk on its own.
To my understanding, the only solution is to use BroadcastReceiver for detecting finished downloads.
By that point in time, the downloaded content will have been saved to disk.
Is there another way to decrypt the file completely in the background, without using a broadcast receiver?
Download the content yourself, using an HTTP client API (e.g., OkHttp), and applying the decryption algorithm as you download.