Open K1rakishou opened 4 years ago
Apparently something is wrong with the Uri, some bad symbols or something like that. After clearing the app data it works with the default paths:
2020-02-03 11:42:40.345 D/MediaProvider: Scanned /storage/emulated/0/Kuroba-dev/files/4chan/g/74603002_g_-_no_update_in_almost_a_yearIs_it_dead/wallhaven-5w3m83_shared.jpg as /storage/emulated/0/Kuroba-dev/files/4chan/g/74603002_g_-_no_update_in_almost_a_yearIs_it_dead/wallhaven-5w3m83_shared.jpg for content://media/external_primary/file/36151
Alright, I think it's either impossible with SAF (because it kinda defeats the whole point of SAF and Scoped Storage) or I'm doing something wrong. Probably the former.
So in case of SAF we will probably have to use SAF file chooser so the user himself selects a file to share and then use the uri it returns. Gonna try this tomorrow.
So this thing doesn't work in the release either and probably won't ever work the way it did because of SAF. SAF won't allow us sharing an Uri to a file into another app. We will have to use ACTION_OPEN_DOCUMENT for that which will show the file picker so the user will have to select a file by himself. They can probably be done by the next release since there were no complains about it meaning nobody uses it.
Oh, apparently you can tell the SAF file picker to open itself in a specific directory:
Callers can set a document URI through DocumentsContract#EXTRA_INITIAL_URI to indicate the initial location of documents navigator. System will do its best to launch the navigator in the specified document if it's a folder, or the folder that contains the specified document if not.
There is also this interesting thing:
To gain access to descendant (child, grandchild, etc) documents, use DocumentsContract#buildDocumentUriUsingTree(Uri, String) and DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String) with the returned URI.