0

I want to trigger media scanner in order to see new photos i have just imported to the device, i was using

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

this way was working perfect, but in android 4.4 (Kitkat) iam getting the following exception

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

i also tried the MediaScannerConnectionClient and still i can see the photos that i had imported in the gallery!!!

how to do so in android 4.4? thanks for helping

AnasBakez
  • 1,230
  • 4
  • 20
  • 36
  • ya ia had tried the `MediaScannerConnectionClient` as in this question but it is not working, iam trind to scan the DCIM folder? is this wrong? or i have to scan every file i had imported? – AnasBakez Nov 11 '13 at 10:31
  • the `scanFile()`-method takes **paths**, not files. So it should search the DCMI folder recursively. – Lukas Knuth Nov 11 '13 at 10:33
  • no it odes not work for me, i had scanned the DCIM folder which contains 5 new photos and non of these photos are shown in the gallery – AnasBakez Nov 11 '13 at 10:39

0 Answers0