evothings / cordova-ble

Bluetooth Low Energy plugin for Cordova
http://www.evothings.com/
Apache License 2.0
242 stars 103 forks source link

Ble bond doesn't work #129

Open easy2dev opened 7 years ago

easy2dev commented 7 years ago

Hi,

When i bonding the device, not popp appear on android 6.0.1. I use jaalee beacon.

Please Help. my source code console.log('BEACON init');

bluetoothle.startScan( function (device){
    if( device.adress == 'E2:3D:76:A1:63:BA'){
        console.log('BNBeacon smart');
        bluetoothle.stopScan(function(){},function(){});
        bluetoothle.bond(function(state){
            if (state == 'bonded' || state == 'unknown')
            {
                console.log('Yess');
                //LIBeacon_Connect(device);

            }
            else if (state == 'bonding')
            {
                console.log('Bonding in progress')
            }
            else if (state == 'unbonded')
            {
                console.log('Bonding aborted');
                //LIBeacon_Init();
            }               
        }, function(error){console.log('bond error :'+error)}, device);
    }
}); 
ghost commented 7 years ago

Hi, I have seen too that no pairing dialog appear, and I have not seen any logic in it.

Sometimes a notification appears that opens the paring dialog when selected, somethings nothing at all is displayed, and sometimes the paring dialog is shown as expected.

It might be that paring for BLE is not fully mature. There could of course also be bugs in the plugin code.

What you can try is to call unbond and bond again. I found it quite tricky to make pairing/bonding work reliably and consistent, on Android as well as on iOS.