2

Is there any callback mechanism on the Android SDK that will notify my application when I insert/remove a microSD card?

Thanks in advance, Parth

1 Answers1

0

You can use an Intent for this. See the ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED Intent constants.

For reference, I searched the web with the terms "android intent sd card insertion"

Edit You may find this question and its answer more helpful; there's code and examples as well as further detail on the two constants I mentioned, ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED

Community
  • 1
  • 1
Alex
  • 8,093
  • 6
  • 49
  • 79
  • As far as I can see Android never produces ACTION_MEDIA_UNMOUNTED Intent. Look at 758 - 763 lines in MountService.java [link](https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/MountService.java). Intent fired on 769 within sendStorageIntent(). – Alan Kazbekov Dec 28 '15 at 14:49