I am working on an application that reads media from the sd-card and plays it.. However, there are certain events when the sd-card is physically removed from the device or the device is attached to a computer and the sd-card is mounted on the computer.. Whenever the sd-card is removed, a notification is generated and can be seen in the notification bar. I want my application to respond to those notifications. For example, whenever the user physically removes the card or attaches it to the computer, I want my application to display a message like “sd card removed”.. Is there any way to respond to these notifications??
Share
No, you don’t. You want to respond to the broadcast
Intentsthat are also used to create thoseNotifications.Look at the documentation for the
Intentclass, at theACTION_MEDIA_*set of broadcast actions.