장치를 다시 검색하여 RSSI를 "새로 고칩니다"스캔 인터벌이 필요합니다. Sth. 이렇게 :
public void scanLeDevice(final boolean enable)
{
final static int SCAN_PERIOD = 2000; //2s
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
final BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter();
//to start or stop scanning (true/false)
if (enable)
{
// Stops scanning after a pre-defined scan period
mHandler.postDelayed(new Runnable()
{
@Override
public void run()
{
mBluetoothAdapter.stopLeScan(mLeScanCallback);
if (mGatt == null)
offScan();
}
}, SCAN_PERIOD);
mBluetoothAdapter.startLeScan(mLeScanCallback);
}
else
{
mBluetoothAdapter.stopLeScan(mLeScanCallback);
}
}
Welcome to StackOverflow. [도움말 센터] (http://stackoverflow.com/help)를 방문하고 [How to Ask] (http://stackoverflow.com/help/how-to-ask)를 읽으십시오. 여기에서 허용되는 질문 유형, 질문 작성 방법 및이 사이트를 효과적으로 사용하는 방법을 배울 수 있습니다. –
또한 이미지가 누락되었습니다. – lokusking