My app is able to take a photo and stores it into a specified folder. Using ES File explorer, I'm able to confirm that the image has been stored in sd card and the specified folder.
However, my gallery is not showing this album immediately. It will need to take quite some time. Is there any ways that i can make the detection immediate using codes?
The following broadcasting codes did not seem to work. My gallery doesnt immediately do a refresh to retrieve the newly created album and image.
Kindly assist. Thanks!
if (type == MEDIA_TYPE_IMAGE){
mediaFile = new File(mediaStorageDir.getPath() + File.separator +
"IMG_"+ timeStamp + ".png");
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri contentUri = Uri.fromFile(mediaFile);
mediaScanIntent.setData(contentUri);
v.getContext().sendBroadcast(mediaScanIntent);
}