Search Unity

How to freely navigate in Android's storage?

Discussion in 'Android' started by masteryder, Jun 25, 2017.

  1. masteryder

    masteryder

    Joined:
    Aug 15, 2016
    Posts:
    5
    Hello,

    I am developing an application for Android which needs to be able to access files from the user's gallery, music list and video list during runtime. The user should be able to browse their files in order to pick the ones that they want to import.

    On the PC (editor) I am free to travel through the file list and load all three kinds of media files.

    But when I build the application with Android, starting at [full package name] folder I'm not able to freely explore the folders as I get the following exception when going down some levels:

    unity UnauthorizedAccessException: Access to the path "/data/user/0" is denied
    at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs).

    I checked in the AndroidManifest and these two lines are present in it:

    <uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />

    <uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />

    First of all I ld like to know if it is normal that I can't access that particular folder, and second, if it is normal that I can't access it, what other alternatives do I have in achieving what I want?

    Thank you