Skip to content

File not open #139

Closed Answered by anggrayudi
ocsike asked this question in Q&A
Discussion options

You must be logged in to vote

Android 10 framework does not allow you to retain the file access once the app is killed, that's why DocumentFileCompat.fromFullPath() returned null. So, storing the file path into a database is not a good idea, unless you have the URI access granted for its parent folder. So, if you want to keep the file access in long-term purpose, you will need to request access to its parent folder first. It can be done via SimpleStorage#requestStorageAccess().

Suppose that your file is in /storage/emulated/0/Pictures/selfie.jpg, then you need to request access for /storage/emulated/0/Pictures, so accessing selfie.jpg will be possible in the future. Example:

storageHelper.onStorageAccessGranted = { _,…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by anggrayudi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants