Search code examples
androidunity-game-enginestorageandroid-storage

Accessing files in InternalStorage/Android/data/package_name/files?


I have an app in which it has a unity part and an android part i.e. on a button click from android it opens a unity game and also downloads some files which are downloaded in "internalstorage/Android/data/packagename/files/File_name".

Now I want to access that file from the android part but I am not getting the path of the Android folder. I have tried all the methods like getDataDir(),getFilesDir() everything but not able to locate the file.

When I check the file through the file manager I can see the file is there on the path.

In unity, I am using Application.persistentdatapath to store the file. I just want to know how I can access that file from the android part. And If I try to access the file from the Unity part I am able to access the file.


Solution

  • Okay i found out instead of getFilesDir() and other method I should be using Environment.getExternalStorageDirectory() this returns the path "/storage/emulated/0 " and the rest I added manually.