I'm using adb to sync music on an android phone. Essentially, I rm the existing music directory and push replacement music files.
I'd like to be able to use adb to force a rescan, so that the google music player (and other apps) works properly with the new songs and playlists.
According to How can I refresh MediaStore on Android? you can force a rescan by broadcasting an appropriate intent.
adb provides 'shell am broadcast', which would seem to allow me to force a rescan from adb.
Alternatively I could run a rescan app or reboot, but I'd like to trigger the rescan from adb
What adb command should I issue? The music files and playlists are all in /sdcard/music.
Search for "Media Storage" but if it's not shown, you may need to unhide it by selecting "Show system" in the 3-dot option menu. Select "Media Storage" and then tap on the "Storage" option. Select "Clear Data" and "OK" when the confirmation dialog appears. This will reset the Android Media Scan database.
adb-sync is a tool to synchronize files between a PC and an Android device using the ADB (Android Debug Bridge).
Finally, you can run ADB commands on your Android device without any computer. You don't need to add adb or adb shell initializers in this app as you are already within the local ADB shell. Just run the operative part of the command and then tap the “Enter” button on the keyboard.
The rescan apps use a media mount intent to kick off the media scanner. You can use am broadcast
to send the same intent.
The command is:
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With