Is there any way to access files in Android with permission from the user?
I think it could be possible using an Android Manifest to require permissions and then access the directories using Native Android Methods but I really don’t have any experience programming directly on Android, so I was wondering what is a good point to begin with and if my hypothesis is correct
I already read this Unity manual page: Building Plugins for Android
But I don’t know if there is something I’m missing, can somebody please tell me what workflow I should follow to accomplish my goal?
Excuse me if I commit some grammar or syntax errors but I’m not a native english speaker
There’s no need to create a plugin for this, you can just use .net System.IO. to create a file browser, and also use Unity’s AndroidJavaClass and AndroidJavaObject to call Android Native Methods like Environment.getExternalStorageDirectory to get the path to the user storage for example.
function GetAndroidExternalStoragePath ()
var path : String = "";
var jc : AndroidJavaClass = new AndroidJavaClass("android.os.Environment") ;
path = jc.CallStatic.<AndroidJavaObject>("getExternalStorageDirectory").Call.<String>("getAbsolutePath");
Best way to accomplish this is by native Android code and you could do this by native Android plugins… There are lot of tutorials out there on how to create an Android plugin for unity and This Tutorial Here
is by far the best i think coz it has nothing to with Android Studio as i m not a big fan of Android Studio … i know Android Studio helps you with java programming but it has other complications too like gradle and all that… okay, so just follow that tutorial and create an android project and where there you are asked to create a java file just put your own code of accessing android file system (or something like this), just google for code on how to access android directories and you are good to go … one thin i want to mention here that is not mentioned in tutorial itself is when you reach this line
ant jar, then before this just cd your project directory … for eg, if you created your android project in C:\MyProject path then before
ant jar execute
cd C:\MyProject so that Apache Ant can find your build.xml