F FabioG Active Member Licensed User Longtime User Oct 28, 2018 #1 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")
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")
Erel B4X founder Staff member Licensed User Longtime User Oct 29, 2018 #2 It is not related to the API level. A field can never be named like this. The correct code is: B4X: wc.GetFieldJO("allowedKeyManagement").RunMethod("set", Array(1)) '1 = WifiConfiguration.KeyMgmt.WPA_PSK Upvote 0
It is not related to the API level. A field can never be named like this. The correct code is: B4X: wc.GetFieldJO("allowedKeyManagement").RunMethod("set", Array(1)) '1 = WifiConfiguration.KeyMgmt.WPA_PSK
F FabioG Active Member Licensed User Longtime User Oct 29, 2018 #3 Erel said: It is not related to the API level. A field can never be named like this. The correct code is: B4X: wc.GetFieldJO("allowedKeyManagement").RunMethod("set", Array(1)) '1 = WifiConfiguration.KeyMgmt.WPA_PSK Click to expand... 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
Erel said: It is not related to the API level. A field can never be named like this. The correct code is: B4X: wc.GetFieldJO("allowedKeyManagement").RunMethod("set", Array(1)) '1 = WifiConfiguration.KeyMgmt.WPA_PSK Click to expand... 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")
F FabioG Active Member Licensed User Longtime User Oct 29, 2018 #4 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
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))
F FabioG Active Member Licensed User Longtime User Oct 29, 2018 #5 sorry, How can I set up WiFi Channel? Upvote 0
F FabioG Active Member Licensed User Longtime User Oct 29, 2018 #6 solved B4X: wc.SetField("apChannel",6) ' 6 is WiFi Channel Upvote 0