FileProvider:- Setting up file sharing
I know that change the file policy in android nougat.
The wanted app that file share to other apps generate the uri by FileProvider.
The uri format is content://com.example.myapp.fileprovider/myimages/default_image.jpg
.
I want know that how can I get filepath from the uri that generate by FileProvider.getUriForFile()
.
because the my app is need to know the physical filepath in order to save, load, readinfo, etc.
is it possible
[In short]
- My app received the intent uri by other apps on andorid 7 nougat.
- The uri format is
content://com.example.myapp.fileprovider/myimages/default_image.jpg
- Maybe it was generate by
FileProvider.getUriForFile
. - I want to know way that get the file path from uri.
- I can just get the mime type, display name, file size and read binay from
getContentResolver().openFileDescriptor()
. but I wnat to know the filepath.
ContentResolver
andopenInputStream()
. Not only can you not determine the path, but even if you could, it is fairly likely that you have no filesystem access to that file anyway. – Irriguous