|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.RNFetchBlob;
|
2
|
2
|
|
|
3
|
+import android.content.Intent;
|
3
|
4
|
import android.media.MediaScannerConnection;
|
4
|
5
|
import android.net.Uri;
|
5
|
6
|
import android.os.AsyncTask;
|
|
@@ -414,15 +415,23 @@ public class RNFetchBlobFS {
|
414
|
415
|
}
|
415
|
416
|
|
416
|
417
|
void scanFile(String [] path, String[] mimes, final Callback callback) {
|
417
|
|
- try {
|
418
|
|
- MediaScannerConnection.scanFile(mCtx, path, mimes, new MediaScannerConnection.OnScanCompletedListener() {
|
419
|
|
- @Override
|
420
|
|
- public void onScanCompleted(String s, Uri uri) {
|
421
|
|
- callback.invoke(null, true);
|
422
|
|
- }
|
423
|
|
- });
|
424
|
|
- } catch(Exception err) {
|
425
|
|
- callback.invoke(err.getLocalizedMessage(), null);
|
|
418
|
+// try {
|
|
419
|
+// MediaScannerConnection.scanFile(mCtx, path, mimes, new MediaScannerConnection.OnScanCompletedListener() {
|
|
420
|
+// @Override
|
|
421
|
+// public void onScanCompleted(String s, Uri uri) {
|
|
422
|
+// callback.invoke(null, true);
|
|
423
|
+// }
|
|
424
|
+// });
|
|
425
|
+// } catch(Exception err) {
|
|
426
|
+// callback.invoke(err.getLocalizedMessage(), null);
|
|
427
|
+// }
|
|
428
|
+ for(String p : path) {
|
|
429
|
+ File file = new File(p);
|
|
430
|
+ Uri uri = Uri.fromFile(file);
|
|
431
|
+ Intent scanFileIntent = new Intent(
|
|
432
|
+ Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
|
|
433
|
+ mCtx.sendBroadcast(scanFileIntent);
|
|
434
|
+ callback.invoke();
|
426
|
435
|
}
|
427
|
436
|
}
|
428
|
437
|
|