how to find Signal Strength of connected bluetooth devices

泄露秘密 提交于 2019-12-21 05:45:27

问题


In one of my applications, I need to display all the wi-fi and Bluetooth devices which are paired to my mobile, and their signal strengths. With wi-fi, it's okay for me to display signal strength (RSSI). But I have a problem with the Bluetooth. I searched for some method which is suitable for this task; I found one method:

intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE);

But it is displaying only the new device RSSI which is not paired to my mobile. Is there any idea for getting all Bluetooth devices RSSI?


回答1:


For bluetooth RSSI, you can read RSSI for connected devices, or perform a bluetooth discovery to check the RSSI for nearby devices.

Basically a bluetooth discovery is a broadcast to all stations within range to respond back. As each devices respons back, Android fires off an ACTION_FOUND intent. Within this intent you can getExtra EXTRA_RSSI to obtain the RSSI.

Note that not all bluetooth hardware supports RSSI.

Also Related: Android IRC Office Hours Question About Android Bluetooth RSSI



来源:https://stackoverflow.com/questions/3020407/how-to-find-signal-strength-of-connected-bluetooth-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!