Last active
August 30, 2016 10:05
-
-
Save wangmuy/c60a1fc694151067c01cbd04fe6c5133 to your computer and use it in GitHub Desktop.
android.media.MassStorageDevice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/7142987/media-mounted-broadcast-not-being-received | |
// 静态 BroadcastReceiver | |
<receiver | |
android:name=".MediaMountedReceiver" | |
android:enabled="true"> | |
<intent-filter> | |
<action android:name="android.intent.action.MEDIA_MOUNTED" /> | |
<data android:scheme="file" /> | |
</intent-filter> | |
</receiver> | |
// 动态 | |
IntentFilter mountedIF = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED); | |
mountedIF.addDataScheme("file"); | |
this.registerReceiver(mMountedReceiver, mountedIF); | |
IntentFilter unmountedIF = new IntentFilter(Intent.ACTION_MEDIA_UNMOUNTED); | |
unmountedIF.addDataScheme("file"); | |
this.registerReceiver(mUnmountedReceiver, unmountedIF); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment