I am trying to get the name of the Wifi network I am currently connected to in a widget on screen.
I use this widget to swich wifi on and off and to show what I am connected to atm.
I found a bit of code on here and adapted it as follows:
Code: Select all
wifiManager=callJavaMethod(getContext(), "android.content.Context", "getSystemService(java.lang.String)", "wifi");
scanResults=callJavaMethod(wifiManager, "android.net.wifi.WifiManager", "getScanResults()");
for(sr in scanResults)
{
global_network_ssid=getJavaField(sr, "android.net.wifi.ScanResult", "SSID");
}
I also know I can get the name of the current connected SSID from WifiInfo#getSSID which I found on here:
https://developer.android.com/reference ... i/WifiInfo
but I can't seem to figure out (as I have no coding background) how to adapt above script to write the global_network_ssid as the value of getSSID
Any help would be greatly appreciated, thanks very much...