magnusja / libaums

Open source library to access USB Mass Storage devices on Android without rooting your device
Apache License 2.0
1.26k stars 270 forks source link

Why receive ACTION_MEDIA_UNMOUNTED broadcast Clearly did not pull out the U disk #291

Closed zgmd closed 3 years ago

zgmd commented 3 years ago

Problem

Expected behavior

Actual behavior

Stacktrace of Excpetion

(if exists)

Code where problem occurs

zFDT commented 3 years ago

You can try to use UsbManager.ACTION_USB_ACCESSORY_DETACHED and UsbManager.ACTION_USB_ACCESSORY_ATTACHED)

zgmd commented 3 years ago

ok,thanks

magnusja commented 3 years ago

ACTION_MEDIA_UNMOUNTED means that the media was umounted, not removed!

So what it tells you is that your Android OS is capable of mounting USB disks. You can just access files as usual over built in Android tools. If you tell libaums now to access the USB disk, then the media is unmounted from Android OS.