Question by
Caleb_Rainwater · Jul 11, 2019 at 03:55 PM ·
androidjavausbandroidjavaobjectuuid
Android getUuidForPath of shared/external storage volumes
Im trying to read a USB OTG on android, I know I have to use getUuidForPath but I'm not entirely sure how to do it. Hopefully from this code you can see what I'm trying to do but I have no experience with AndroidJavaClass/Objects in Unity.
AndroidJavaClass storageVolume = new AndroidJavaClass("android.os.storage.StorageVolume");
AndroidJavaClass storageManager = new AndroidJavaClass("android.os.storage.StorageManager ");
try{
AndroidJavaObject[] storageVolumeList = storageManager.Call<AndroidJavaObject[]>("getStorageVolumes");
foreach(AndroidJavaObject ajo in storageVolumeList ){
string id = ajo.Call<string>("getUuidForPath");
list.Add(id);
}
}catch(Exception e){
list.Add(e.ToString());
}
Maybe someone can point me in the right direction? thanks.
Comment
Your answer
Follow this Question
Related Questions
Why is USB Storage being detected only in some android devices and not all? 2 Answers
JAVA_HOME environment references a directory 1 Answer
Debug Android device in Unity (via USB) 2 Answers
Create background service from Android Plugin 0 Answers
[BUG] AndroidJavaObject getStringArrayExtra() crash 1 Answer