I have an application that manipulates images, it has options to move and delete images, when deleting an image is sent a boradcast so that the android gallery application recognizes that the image is no longer there. It works perfectly, except Android 4.4!
I'm using it like this:
public void forceMediaScan(String path){
File f1 = new File(path);
Intent scanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
scanIntent.setData(Uri.fromFile(f1));
getActivity().sendBroadcast(scanIntent);
}
I've already researched and tried scanFile, but it does not work, the Android 4.4 Gallery app does not recognize the change
MediaScannerConnection.scanFile(getActivity(), new String[]{path}, null,null);
I have tried to use scanFile for a specific file and for an entire path (which is the case in the example), but it does not work.