0

I'm going to automate the reconnection of the headphones between my computer and phone based on events on the phone and computer. how can i tell my phone (using adb) to connect to the known headphones ? now i can connect/disconnect it to my pc. and on phone i can on/off bluetooth and get list of bonded devices..

i know its mac if needed.. now i can [dis]connect my phones from pc using:

bluetoothctl connect [MAC] and bluetoothctl disconnect [MAC]

and line in bash script if [[ $(bluetoothctl info [MAC] | grep "Connected: no") == "" ]]; to get state.

i'm using adb shell settings put global bluetooth_disabled_profiles 1 to turn phone bt on and "0" at the end to turn off(to disconnect from headphones e.g.). using the

adb shell "dumpsys bluetooth_manager | sed -n '/Bonded devices:/,/^$/p'"

command i'm getting bt devices list with mac, supported bt profiles and some other info that i cant identify. will it help me to write a command to connect headphones to phone?..

0

You must log in to answer this question.

Browse other questions tagged .