我有以下 android 代码,它创建与远程设备的蓝牙连接。有什么方法可以发现远程设备超出范围?
private void connectToRobot(BluetoothDevice bd){
try{
Method m = bd.getClass().getMethod("createRfcommSocket",
new Class[] {int.class});
socket = (BluetoothSocket) m.invoke(bd, 1);
socket.connect();
Toast.makeText(AndroidBluetooth.this,"CONNECTED ",
Toast.LENGTH_LONG).show();
os = socket.getOutputStream();
}catch (Exception e){
Log.e(tag,"Error interacting with remote device [" +
e.getMessage() +"]");
}
}
我现在唯一能得到的信息是 BluetoothSocket 是否成功。有没有办法确定连接的强度?