利用亚行刷新的Andr​​oid mediastoreAndr、oid、mediastore

2023-09-03 21:05:43 作者:妄定

我使用亚行同步音乐在Android手机上。从本质上讲,我RM现有的音乐目录和推更换音乐文件。

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.

根据我怎样才能刷新MediaStore在Android?你可以通过广播适当的意图强制重新扫描。

According to How can I refresh MediaStore on Android? you can force a rescan by broadcasting an appropriate intent.

亚行提供壳AM广播,这似乎让我从亚行强制重新扫描。

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

我应该发出什么ADB命令?音乐文件和播放列表都在/ SD卡/音乐。

What adb command should I issue? The music files and playlists are all in /sdcard/music.

推荐答案

重新扫描应用程序使用装入介质的意图揭开序幕媒体扫描仪。您可以使用 AM广播发送相同的意向。

The rescan apps use a media mount intent to kick off the media scanner. You can use am broadcast to send the same intent.

的命令是:

adb shell am broadcast android.intent.action.MEDIA_MOUNTED