I have an android app that downloads a zip file into the public downloads folder and then tries to unzip it. With the new file permissions in android 12, the only way I have been able to get this to work is by using the MANAGE_EXTERNAL_STORAGE permission. However, the play store keeps rejecting my app. How can I perform this operation with out needing the permission? The zip file is in the same directory it is being unzipped into.
File unzip_directory = new File(ContextCompat.getExternalFilesDirs(this,
Environment.DIRECTORY_DOWNLOADS)[0], "zipfile");
if (!unzip_directory.exists()) unzip_directory.mkdirs();
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(download_id);
Cursor cursor = download_manager.query(query);
cursor.moveToFirst();
int fileUriIdx = cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI);
String fileUri = cursor.getString(fileUriIdx);
zip_file = new File(Uri.parse(fileUri).getPath());
ZipInputStream zip_stream = new ZipInputStream(new FileInputStream(zip_file)); // crashes here open failed: EACCES (Permission denied)