Search code examples
androidautomationadb

How can I play a mp3 file via adb command with google play music on android kitkat 4.4.4?


I just have tried the old method of start to play a .mp3 file with adb command.

adb shell am start -n com.google.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/Music/abc.mp3

But currently it does not work. Could any one help to check if there are any updated ways to do so?


Solution

  • Issue resolved by using command such as:

    (file path: /storage/sdcard0/test.wav)

    adb shell am start -a android.intent.action.VIEW -d file:///storage/sdcard0/test.wav -t audio/wav
    

    (file path: /storage/emulated/0/test.wav)

    adb shell am start -a android.intent.action.VIEW -d file:///storage/emulated/0/test.wav -t audio/wav