How to check IOException cause on the catch?
Is e.getCause().getMessage()
always returns the same string on all the android versions and devices for the same cause? Is it a good approach to check if IOException's cause is android.system.ErrnoException: write failed: ENOSPC (No space left on device)
for checking if the user's device is out of space on that specific drive?
try {
// Here I'm writing a file with OutputStream
} catch (IOException e) {
// Check if IOException cause equals android.system.ErrnoException: write failed: ENOSPC (No space left on device)
} finally {
}