Android Question Set WiFiConfiguration on API 23

FabioG

Active Member
Licensed User
Longtime User
Hi to all,

I have problems with WiFiConfiguration set on Android API 23
using the code below I get this error

(RuntimeException) java.lang.RuntimeException: Field: allowedKeyManagement.set not found in: android.net.wifi.WifiConfiguration

can someone help me ?

thanks a lot

B4X:
        Dim wc As JavaObject
        wc.InitializeNewInstance("android.net.wifi.WifiConfiguration", Null)
        wc.SetField("SSID", "TestAP")
        wc.SetField("preSharedKey", "testpassword")
        wc.SetField("hiddenSSID", False)
        wc.SetField("status", 1)
        wc.SetField("allowedKeyManagement.set", "WifiConfiguration.KeyMgmt.WPA_PSK")
 

FabioG

Active Member
Licensed User
Longtime User

thank you very much Erel
so I use the same logic for these too?

B4X:
        wc.SetField("allowedGroupCiphers.set", "WifiConfiguration.GroupCipher.TKIP")
        wc.SetField("KeyMgmt", "1")
        wc.SetField("allowedProtocols.set", "WifiConfiguration.Protocol.RSN")
 
Upvote 0

FabioG

Active Member
Licensed User
Longtime User
I'm used

B4X:
        wc.GetFieldJO("allowedAuthAlgorithms").RunMethod("set", Array(0))
        wc.GetFieldJO("allowedProtocols").RunMethod("set", Array(1))
        wc.GetFieldJO("allowedKeyManagement").RunMethod("set", Array(1))
        wc.GetFieldJO("allowedPairwiseCiphers").RunMethod("set", Array(2))
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…