I have a an android Setup Box in which 2gb internal Memory available and 8 gb external memory available and device has slots for connect USB device. I wanted to get Memory information of connected USB Device. Suppose i have connected more then one USB Device. I am getting connection Disconnection event using Broadcast Receiver. But if i wanted to get Memory information that i am unable to get. I am only able to get inbuilt external memory information Please Guide me.
I am very new to android development. I have tried this way
private void sizeInfo(){
File path = Environment.getDataDirectory();
StatFs stat2 = new StatFs(path.getPath());
long blockSize = stat2.getBlockSize();
long availableBlocks = stat2.getAvailableBlocks();
String format = Formatter.formatFileSize(this, availableBlocks * blockSize);
// Log.d("space","Path : "+ path +"\n");
Log.d("space","Available Space in GB : "+ format);
String str = Environment.getExternalStorageState();
//Log.d("Checking","Media "+Environment.isExternalStorageEmulated());
}
I am getting list of attached device by following
private void updateDeviceList() {
Log.d("Checking","updateDeviceList function");
int DivCount =0;
HashMap<String, UsbDevice> connectedDevices = mUsbManager.getDeviceList();
if (connectedDevices.isEmpty()) {
usbDevice = null;
Log.d("Checking", "No Currently Device Conneted");
} else {
for (UsbDevice device : connectedDevices.values()) {
DivCount++;
Log.d("Device Info","DeviceId " +device.getDeviceId()+"\n");
Log.d("Device Info","ProductId "+device.getProductId()+"\n");
Log.d("Device Info","DeviceName "+device.getDeviceName()+"\n");
Log.d("Device Info","DeviceClass "+device.getDeviceClass());
String str = Build.MANUFACTURER;
Log.d("Device Info","Model "+str);
usbDevice =device;
sizeInfo();
}
}
}
I am able to get attached device list but not able to getting memory information of removable usb