We had to list down and play some bundled MP3 files from our android application. We added a zip file with proper folder structure inside assert. Application will extract that into /data/data/{package name}/files/ folder on loading and make use of this.
In this both Media Metadata Retriever or Media Player API didn't work if we use direct file-name or URI.
First I was thinking the issue in permission of the written file, I manage to write files with the permission -rw-rw-rw but that was not enough. Issue was with owner. Those written files owner and group as same as the application not root or etc.
I couldn't find a API to change the owner of a file.But lucky, Media Metadata Retriever and Media Player API could accept File Descriptor, So We had to use FileInputStream to get The File Descriptor and pass it to tose APIs.
In this both Media Metadata Retriever or Media Player API didn't work if we use direct file-name or URI.
First I was thinking the issue in permission of the written file, I manage to write files with the permission -rw-rw-rw but that was not enough. Issue was with owner. Those written files owner and group as same as the application not root or etc.
I couldn't find a API to change the owner of a file.But lucky, Media Metadata Retriever and Media Player API could accept File Descriptor, So We had to use FileInputStream to get The File Descriptor and pass it to tose APIs.