+
+ public void triggerMediaScan(String path) {
+ Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+ intent.setData(Uri.fromFile(new File(path)));
+ MainApp.getAppContext().sendBroadcast(intent);
+ }
+
+ public void deleteFileInMediaScan(OCFile file) {
+
+ String path = file.getStoragePath();
+ if (file.isImage()) {
+ // Images
+ getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Images.Media.DATA + "=?", new String[]{path});
+ } else if (file.isAudio()) {
+ // Audio
+ getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Audio.Media.DATA + "=?", new String[]{path});
+ } else if (file.isVideo()) {
+ // Video
+ getContentResolver().delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Video.Media.DATA + "=?", new String[]{path});
+ }
+ }
+