Search code examples
c#xamarin.androidwifi

Monodroid: How to set the AllowKeyManagement property of a WifiConfiguration


I must be missing something here but I am trying to set the AllowedKeyManagement property of a WifiConfiguration like so:

config.AllowedKeyManagement = WifiConfiguration.KeyMgmt.None;

However, AllowedKeyManagement is of type BitSet and there's no conversion from KeyManagementType. Also tried Android.Net.Wifi.KeyManagementType.None which obviously results in the same issue.

Any help would be appreciated.


Solution

  • So after an email discussion with Xamarin you cannot simply assign the enum values to AllowedKeyManagement and the same applies to AllowedGroupCipher (or indeed anything value of type BitSet). The enum has to be converted to a BitSet and there is an example here:

    https://stackoverflow.com/a/2473719/1555582

    I've not tested this yet but if the conversion does not work then I suggest this would result in a different question being posed.