I need to get a broadcast reception when the media unmounts ie before it is unmounted.
So that I can save the file to the SD card before unmounting the Media.
I used android.intent.action.MEDIA_UNMOUNTED.
<intent-filter> <action android:name="android.intent.action.MEDIA_UNMOUNTED" /> <data android:scheme="file" /> <category android:name="android.intent.category.HOME" /> </intent-filter>
But it was received after the media was turned off, and then I could not save the file.
I also tried MEDIA_EJECT, MEDIA_SHARED, all obtained after Media Unmounted.
Is there any other way to save the file. I do not want to use Thread to save the file.
source share