0

我想触发媒体扫描仪以查看我刚刚导入设备的新照片,我正在使用

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

这种方式工作得很好,但在 android 4.4 (Kitkat) 中,我得到了以下异常

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.MEDIA_MOUNTED

我也试过了MediaScannerConnectionClient,但我仍然可以看到我在画廊中导入的照片!!!

如何在 android 4.4 中这样做?谢谢你的帮助

4

0 回答 0