Menu

#123 MediaStore not updated after file rename/move on Android 11+

v1.0_(example)
open
nobody
None
1
2026-07-08
2026-07-08
dis8848
No

In MediaScanEngine.java, the scanMedia() method has:

if( android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.Q ) {
Log.w( TAG, "Android takes care itself." );
return;
}

This assumes Android automatically updates MediaStore after
file operations on API 30+, but this is not always true —
especially for direct File.renameTo()/move operations that
bypass the MediaStore API on scoped storage.

Steps to reproduce:

  1. Rename or move a media file using Ghost Commander on Android 11+
  2. Check MediaStore/gallery apps — the old entry remains stale,
    new file is not indexed

Expected: MediaStore should reflect the change (old entry removed,
new path scanned), similar to behavior on Android 10 and below.

Suggested fix: call MediaScannerConnection.scanFile() or
MediaStore.scanFile() explicitly even on newer Android versions,
or use ContentResolver.update() to reflect path changes.

Discussion


Log in to post a comment.