我试图通过点击按钮获得连接的蓝牙设备的当前RSSI值.但是它总是只返回-32768!不知道有什么不对!然而,当它第一次连接时,我能够获得正确的RSSI.
private Button.OnClickListener buttonRSSIOnClickListener = new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(BluetoothDevice.ACTION_FOUND);
short rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);
Toast.makeText(getApplicationContext()," RSSI: " + rssi + "dBm", Toast.LENGTH_SHORT).show();
}};
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?