How to unpair a bluetoothle devices in xamarin forms?

AswathyAswathy Member ✭✭✭
edited May 18 in Xamarin.Forms

I want to unpair a paired device from my app, I am using this link to develop my app:- https://github.com/aritchie/bluetoothle .

Here is my code to unpair

  public bool UnPair(BLEDevice bleDevice)
     {
        bool _paired = false;

        try
        {
            BluetoothDevice device = (BluetoothDevice)bleDevice.ActualDevice.NativeDevice;

            Method m = device.Class.GetMethod("removeBond",null);

            m.Invoke(device,null);

            _paired = device.BondState == Bond.Bonded ? true :false;

        }
        catch (System.Exception ex)
        {

        }

        return _paired;
    }

Posts

Sign In or Register to comment.