How to control bluetooth operations using adb shel

2019-01-09 17:10发布

问题:

I am working on automating bluetooth actions on android like enable/disable, pairing/unpairing devices etc.

I want to know how to interact with unrooted android device for above mentioned bluetooth operations using adb shell commands or android intents.

For example, i want to know which devices are bluetooth paired with my android phone using adb shell commands.

is it possible?

回答1:

dumpsys is your friend:

  • Find your bluetooth service (must be running): adb shell dumpsys -l
  • Mine is bluetooth_manager, so I run: adb shell dumpsys bluetooth_manager
  • In output you can find section "Bonded devices"