The problem is well known: if you make changes in to filesystem using a method that does not notify Media Storage, then browsing your device via MTP won't show the changes (eg. new files, etc.).
There're lots of solutions/workarounds too:
- rebooting your device
- using an app (just for this purpose) that will initiate a media scan for you
- using an app (eg. the camera) that will initiate a media scan after some action (eg. taking a picture)
- clearing the data of the Media Storage (com.android.providers.media) app
- using CyanogenMod's builtin DevTools app which has a "Media Provider" activity, where you can initiate a media scan
- and finally: using the "am" command to send
the android.intent.action.MEDIA_MOUNTED broadcast intent to the Media Provider
am broadcast -a android.intent.action.MEDIA_MOUNTED -n com.android.providers.media/.MediaScannerReceiver ... or
am broadcast -a android.intent.action.MEDIA_MOUNTED -n com.android.providers.media/.MediaScannerReceiver -d file:///storage/emulated/0 if you want to specify a single file or directory)
The latter is pretty nice, because there're lots of ways to launch the appropriate commandline. Eg. you can easily create a Tasker task and a widget to launch it.
P.S.: apparently KitKat (4.4.*) brought a change
that causes the
broadcast event method to fail ... and of course all apps that used this method. But running the
command still works, just needs root (at least in Tasker it needed root).