Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to unpair a bluetoothle devices in xamarin forms?

$
0
0

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;
    }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>