I did a binding of libaums AAR in my Xamarin Android solution in Visual Studio.
I used 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
At compile time I got 2 errors that I solved by adding those directives to my Metadata.xml file:
IUsbFile
IUsbFile
Then I tried to implement the example found on the libaums github to get the mass storage devices:
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); }
But at run time I have an exception on currentFs.Capacity which says 'no non-static method "Lcom/github/mjdev/libaums/fs/fat32/Fat32FileSystem;getCapacity()J"'
Any ideas?
Answers
The directives in Metadata.xml are as follows :
<attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createDirectory']" name="managedReturn">IUsbFile</attr>
<attr path="/api/package[@name='com.github.mjdev.libaums.fs.fat32']/class[@name='FatDirectory']/method[@name='createFile']" name="managedReturn">IUsbFile</attr>
I finally solved my problem in doing some modifications in the libaums Java source code.