<attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createDirectory' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr> <attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createFile']" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr>
Yes I did that but I am having an exception while querying currentFs.Capacity in the below code :
UsbMassStorageDevice[] devices = UsbMassStorageDevice.GetMassStorageDevices(Global.MyActivity.ApplicationContext);
foreach (UsbMassStorageDevice device in devices)
{
// before interacting with a device you need to call init()!
device.Init();
// Only uses the first partition on the device
IFileSystem currentFs = device.Partitions[0].FileSystem;
Console.WriteLine("Capacity: " + currentFs.Capacity);
Console.WriteLine("Occupied Space: " + currentFs.OccupiedSpace);
Console.WriteLine("Free Space: " + currentFs.FreeSpace);
Console.WriteLine("Chunk size: " + currentFs.ChunkSize);
}
Thanks but I built the 0.5.2 AAR under Android Studio 2.3.3, then I did bind the AAR under an Android Binding Library project under Visual Studio 2015 but I am still facing the same exception.
Do you have an example of a code that works for you when you call the binding library?
Though I am new to Java I did some modifications to the libaums source code and I got it to work. I am now able to list the content of the root directory of a USB stick, create a foler and a text file Inside that folder.
But sadly every call to UsBMassStorage.Init() has a bad interaction with my app as it ends in a crash after the several operations on the USB stick.
Answers
Did you get it to work?
I am trying to do the same but I am having this issue : https://forums.xamarin.com/discussion/105463/binding-libaums-aar-in-a-xamarin-android-project
@ebesnard try to add these into Metadata file:
<attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createDirectory' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr> <attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createFile']" name="managedReturn">Com.Github.Mjdev.Libaums.FS.IUsbFile</attr>
Yes I did that but I am having an exception while querying currentFs.Capacity in the below code :
What version of libaums did you use ? I am using libaums-0.5.0.aar from here : https://bintray.com/package/files/mjdev/maven/libaums?order=asc&sort=name&basePath=com/github/mjdev/libaums/0.5.0&tab=files
0.5.2
And where did you get the AAR? I cannot find it on the web. Could you please share it?
Also, I am using Visual Studio 2015, and you?
Would be great if you could share your 0.5.2 AAR cause I still can't find it on the web.
https://github.com/magnusja/libaums/releases
Thanks but I built the 0.5.2 AAR under Android Studio 2.3.3, then I did bind the AAR under an Android Binding Library project under Visual Studio 2015 but I am still facing the same exception.
Do you have an example of a code that works for you when you call the binding library?
Though I am new to Java I did some modifications to the libaums source code and I got it to work. I am now able to list the content of the root directory of a USB stick, create a foler and a text file Inside that folder.
But sadly every call to UsBMassStorage.Init() has a bad interaction with my app as it ends in a crash after the several operations on the USB stick.
I finally found why UsbMassStorage.Init() had a bad interaction with the rest of my code, it wasn't due to the libaums Library.
@ebesnard , I also have problem on UsbMassStorage.Init() and it crash my app. Could you please tell me know where the problem is?