not allowed to send broadcast android.intent.action.MEDIA_MOUNTED from pid
2017-01-17 00:11
681 查看
我在今天画一个画布的时候存储的时候发现了这个问题
加读写权限并不能解决问题
在stackoverfollow中找到了一个办法,在高版本中使用ACTION_MEDIA_SCANNER_SCAN_FILE去通知系统重新扫描文件。代码如下:
加读写权限并不能解决问题
在stackoverfollow中找到了一个办法,在高版本中使用ACTION_MEDIA_SCANNER_SCAN_FILE去通知系统重新扫描文件。代码如下:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//这里主要进行了一下判断呢 在高版本的时候通知系统重重新扫描文件 Intent mediaScanIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(file); //out is your output file mediaScanIntent.setData(contentUri); Main2Activity.this.sendBroadcast(mediaScanIntent); }else { Intent intent = new Intent(); intent.setAction(Intent.ACTION_MEDIA_MOUNTED); intent.setData(Uri.fromFile(file)); sendBroadcast(intent); }
相关文章推荐
- 关于 Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED from 错误原因
- 解决android4.4中 Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED from pid=2269,
- 关于Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED解决方法
- Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Android问题(二)not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Android问题集锦之三十八:not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- 解决 not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Android问题集锦之三十八:not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- 解决android4.4中 Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED解决方法
- 【Android】not allowed to send broadcast android.intent.action.MEDIA_MOUNTED
- android中bug——not allowed to send broadcast android.intent.action.phone_state
- Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG
- Permission Denial: not allowed to send broadcast android.intent.action.SCREEN_OFF
- 异常问题not allowed to send broadcast android.intent.action.BATTERY_CHANGED可能的一种解决方案
- Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.int
- Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.int
- android java.lang.SecurityException: Permission Denial: not allowed to send broadcast