Ble Device无法随机连接外设android

时间:2016-02-06 07:07:22

标签: android connection bluetooth-lowenergy

我正在使用ble服务连接外设,但连接有奇怪的问题,有些时候以下方法没有连接设备,有时它完美地工作,比例为10:1

private void scanLeDevice(final boolean enable) {
    if (enable) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mBluetoothAdapter.stopLeScan(mLeScanCallback);
                connectToPeripheral();
            }
        }, 15000);
        mBluetoothAdapter.startLeScan(mLeScanCallback);
    } else {
        mBluetoothAdapter.stopLeScan(mLeScanCallback);
    }
}

Method connectToPeripheral is for connection and data receiving,I stuck with problem since long time don't have any idea why this happening if i kill the app than connect still have same problem.is it problem of Advertising delay? 

0 个答案:

没有答案
相关问题