52

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.

4

5 に答える 5

55

再スキャン アプリは、メディア マウント インテントを使用してメディア スキャナーを開始します。を使用am broadcastして同じインテントを送信できます。

コマンドは次のとおりです。

adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard
于 2013-10-17T19:53:46.410 に答える