目前最完整的,需要注册的动作匹配如下:
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED); intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); intentFilter.addAction(Intent.ACTION_MEDIA_CHECKING); intentFilter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL); intentFilter.addDataScheme("file"); mContext.registerReceiver(mMediaReceiver, intentFilter);