I'm trying to sign into a (known) hidden SSID with this java code:
found here on stack overflow.
When I compile it, I am getting this error:
Can someone assist me with this? I'm not sure what is wrong with it...
Thanks in advance,
Rusty
B4X:
...
Sub Process_Globals
...
Private NativeMe As JavaObject
...
Dim Credentials(2) As String
Credentials(0) = SSID
Credentials(1) = Pass
NativeMe.InitializeContext
NativeMe.RunMethod("setWifiConfig", Credentials) 'run the Java method
...
#If JAVA
public void setwificonfig(string ssid, string sharedkey) {
wificonfiguration conf = new wificonfiguration();
conf.ssid = "\"" + ssid + "\""; // please note the quotes. string should contain ssid in quotes
conf.presharedkey = "\"" + sharedkey + "\"";
conf.hiddenssid = true;
conf.status = wificonfiguration.status.enabled;
conf.allowedgroupciphers.set(wificonfiguration.groupcipher.tkip);
conf.allowedgroupciphers.set(wificonfiguration.groupcipher.ccmp);
conf.allowedkeymanagement.set(wificonfiguration.keymgmt.wpa_psk);
conf.allowedpairwiseciphers.set(wificonfiguration.pairwisecipher.tkip);
conf.allowedpairwiseciphers.set(wificonfiguration.pairwisecipher.ccmp);
conf.allowedprotocols.set(wificonfiguration.protocol.rsn);
conf.allowedprotocols.set(wificonfiguration.protocol.wpa);
wifimanager wifimanager = (wifimanager)context.getsystemservice(context.wifi_service);
wifimanager.addnetwork(conf);
list<wificonfiguration> list = wifimanager.getconfigurednetworks();
for (wificonfiguration i : list) {
if (i.ssid != null && i.ssid.equals("\"" + ssid + "\"")) {
wifimanager.disconnect();
wifimanager.enablenetwork(i.networkid, true);
wifimanager.reconnect();
wifimanager.saveconfiguration();
break;
}
}
}
#End If
When I compile it, I am getting this error:
B4A Version: 7.30
Parsing code. (0.08s)
Compiling code. (0.26s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Generating R file. (0.13s)
Compiling debugger engine code. (6.43s)
Compiling generated Java code. Error
B4A line: 454
End Sub
javac 1.8.0_51
src\talkingsurvey\b4a\surveydeploy\main.java:2329: error: cannot find symbol
public void setwificonfig(string ssid, string sharedkey) {
^
symbol: class string
location: class main
Can someone assist me with this? I'm not sure what is wrong with it...
Thanks in advance,
Rusty