1
我正在开发一个应用程序,我必须连接到Android 4.3上的Bluetooth Low Energy设备。如何在Android 4.3中实时获取蓝牙设备的RSSI?
当我按下按钮,我可以得到BLE装置的RSSI利用BluetoothLeService.readRemoteRssi();
后连接到设备上,但我想要得到的RSSI在每一秒? 我尝试了Runnable,但它不会在日志中调用readRemoteRssi();
函数。
最终可运行可运行=新的Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
mBluetoothLeService.readRemoteRssi();
mHandler.postDelayed(runnable, 1000);
}
};
我应该在哪里输入BluetoothLeService.readRemoteRssi();
?
in onResume
??或者怎么做才能让APP始终获得RSSI?
对不起我的英文,我只是新手。
感谢您的指导!
添加
mHandler.postDelayed(runnable, 1000);
感谢您向我们提供的解决方案,因为我来到了这个两年后:) – Gannic