简体   繁体   中英

How to set Codec on Android phone using adb command for bluetooth connected device?

I am trying to write Automation with my Bluetooth device(earbuds) and my phone, for this I am using ADB commands. I am able to find ADB commands to play Music from the device's stored file and control it like play, pause, forward, and backward. To check supported codecs and Audio results with different codecs, bit rate, need to change the codec from an Android device. Note: I don't have any idea about the Android device code or Application, I am using one system that is connected with buds and an Android device, so trying to use ADB commands. Please suggest a better option to switch codec in the Development settings on an Android device.

I tried google search and found one way,but looking for a better option. Based on Google search: Open Development Setting using the below command: adb shell am start -a com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS Note: Need to enable Developer mode before this command. Then swipe the setting using the below command: adb shell input swipe 0 1000 0 0 Then click specific setting using the below tap command: adb shell input tap 600 910 The issue is this will work only for a single device, I want to support multiple Android devices as source devices in Automation. Just for reference, with below commands able to play music and control it: adb shell am start -a android.intent.action.VIEW -d file:///storage/emulated/0/Download/xyz.MP3 -t audio/mp3" adb shell input keyevent 85 85 --> "KEYCODE_MEDIA_PLAY_PAUSE" 86 --> "KEYCODE_MEDIA_STOP" 87 --> "KEYCODE_MEDIA_NEXT" 88 --> "KEYCODE_MEDIA_PREVIOUS" 89 --> "KEYCODE_MEDIA_REWIND" 90 --> "KEYCODE_MEDIA_FAST_FORWARD" 91 --> "KEYCODE_MUTE"

Let me know if there is any way to select the different codecs over android phone using adb?

I tried google search and found one way,but looking for a better option. Based on Google search: Open Development Setting using the below command: adb shell am start -a com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS Note: Need to enable Developer mode before this command. Then swipe the setting using the below command: adb shell input swipe 0 1000 0 0 Then click specific setting using the below tap command: adb shell input tap 600 910 The issue is this will work only for a single device, I want to support multiple Android devices as source devices in Automation.

The Bluetooth codec negotiation is done by the Bluetooth stack and cannot be changed by the application. Unless you want to compile your own Android distribution with a modified Bluetooth stack, you will not be able to achieve your goal.

See Bluetooth Services / Advanced audio codecs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM