Reputation: 1551
Is there a way to let my app know that Media (SDCard) was mounted/unmounted while my app was turned off? I mean that my app and its services were Destroyed, not only stopped. Probably, some ways to check MediaStore checksum are available?
Goal: decide if new music files were added or deleted in device memory to refresh general playlist.
Upvotes: 0
Views: 875
Reputation: 6071
Why not check if the SDCARD is mounted by using Environment.getExternalStorageState()
upon restarting your app? The value you want it to be is Environment.MEDIA_MOUNTED
. You could do it async and display a message somewhere stating that an update is in progress, however...
...if it's really the callback-ish thing you need, then you'll have to have a look at what John Willis wrote about registering a BroadcastReceiver.
Upvotes: 1
Reputation: 6317
You have register a broadcast receiver to receive an intent android.intent.action.MEDIA_MOUNTED
Upvotes: 1