I have a program that uses content from sd-card. I want to listen to different states like sd-card mounted or sd-card removed unexpectedly. How can I do so. An example would be of a great help.
Thanks to all
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to listen for ACTION_MEDIA_REMOVED and ACTION_MEDIA_MOUNTED. Create a receiver and listen for this action.
EDIT:
In your manifest file add this
then create a class MyReceiver which will extend BroadcastReceiver and then catch these actions and perform what you want to do.