I'm here speaking in context of USB not a Memory card or Internel memory and need a exact path not a Uri.
Till Android L i get a File path from a /mnt or /storage or any other directory.but in marshmallow i didn't find where my usb is exactly.
then i move forward towards the Storage Access Framework.but it's not returning the actual path it's return me a Uri.
I also go through the AFileChooser Project and A stackoverflow post Android Gallery on KitKat returns different Uri for Intent.ACTION_GET_CONTENT
but It's not helpfull.So is there any way i can access the Realpath like (/storage/abc/filename.mp4).
then i move forward towards the Storage Access Framework.but it's not returning the actual path it's return me a Uri.
That is because the Storage Access Framework does not work with files. It works with storage providers. Storage providers are welcome to store their pieces of content however their developers want. That can include content stored on servers, content stored in databases, content stored in encrypted containers, content generated on the fly, and so on. None of those have an "actual path" that is meaningful to you. And, if you are using the Storage Access Framework, the user can choose whatever storage provider that the user wants.
So is there any way i can access the Realpath like (/storage/abc/filename.mp4).
Make your own copy of the content, using the Uri
and Java I/O. Then you know the "Realpath" of your copy.
A Uri
is like a URL. There is no requirement for the URL of this Web page to map to some file on your computer. There is no magic algorithm that will convert a URL to a local file path... other than to download the content yourself and create a local file.