I have a FileManager app in Android (For UI) which uses a rust library internally (To do all the heavy lifting like CRUD File Operation). This app handles Usb drive also.
When I attach a USB drive to phone, I take all the necessary permissions from users like Usb access permission, Usb Read/Write permission, Android Phone Storage permission etc.
I am able to do Write operations on My Usb drive using the Rust standard library (std::fs), But on some of the OEM's (Samsung, Asus, and some other, Irrespective of Android versions) It fails with error
"Os { code: 13, kind: PermissionDenied, message: "Permission denied" }"
E.g, When I create a directory using below code, If give me success for some OEMs, But at the same time, It fails for Some of the devices.
match std::fs::create_dir(path) {
Ok(()) => {
println!("Directory created successfully");
Ok(true)
}
Err(err) => Err(err),
}
PS : I have taken all the permissions for Usb from user.