I have an app which copies .pdf files from assets and saves them locally. The user can then open the .pdf in a third party app using intents to make annotations and then save the .pdf. Once the user saves the annotated .pdf, I now lose permission to the .pdf. For instance, if they save it in the same location (overwriting original file), I receive EACCES PERMISSION DENIED when trying to reopen it. If the user saves it in a separate directory, I don’t receive an error but it’s as if the file doesn’t exist. When I check to see if the directory exists with .exists(), it returns true but when I run listFiles() on the directory, it returns null.
Below is an example of the directory I am using.
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS + "/Folder Name")
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS + "/Folder Name").exists()
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS + "/Folder Name").listFiles()
My understanding is I don’t need to request permissions but for the heck of it, I did add <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
to my manifest and this did not solve the issue. Any ideas why this is happening?