Check Bluetooth status in Xamarin Forms on iOS

Viewed 2622

I have created a xamarin forms application. I want to check if the status of the bluetooth in iOS. I have used the below code, but the if (state == CBCentralManagerState.PoweredOn) is returning me Unknown. It is not providing the actual status of bluetooth state. Could somebody please help me to figure out what is wrong ? Thanks.

The reference of this method is here : https://developer.xamarin.com/api/type/MonoMac.CoreBluetooth.CBCentralManagerState/

   private CBCentralManagerState state;

    public bool CheckBluetoothStatus()
    {
        bool status;
        if (state == CBCentralManagerState.PoweredOn)
        {
            status=  true;
        }
        else
        {
            status =  false;
        }
        return status;   

    }
2 Answers
Related