- Home /
The question is answered, right answer was accepted
How can I get the WiFis name?
Hi, i'm doing a game to both android and IOs platforms, and i need to know if the users is connected to a certain WiFi, i can know if the user is conected to a WiFi using
`if(Application.internetReachability==NetworkReachability.ReachableViaLocalAreaNetwork)`
but i need to know more info about that WiFi, overall the name of the WiFi, how can it be done in C#?
Thanks in advance.
[EDIT]
Now i'm using [Managed WiFi Api][1], in the PC I can get the WiFi name using:
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using NativeWifi;
public void InterfacesNetwork(){
WlanClient wlan = new WlanClient();
List<string> connectedSsids = new List<string>();
foreach (WlanClient.WlanInterface wlanInterface in wlan.Interfaces)
{
Wlan.Dot11Ssid ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid;
//connectedSsids.Add(new String(Encoding.ASCII.GetChars(ssid.SSID,0, (int)ssid.SSIDLength)));
Debug.Log("ssid en string: "+ssid.ToString());
Debug.Log(ssid.SSID.ToString());
}
foreach(WlanClient.WlanInterface wlanIface in wlan.Interfaces){
foreach(Wlan.WlanProfileInfo profileinfo in wlanIface.GetProfiles()){
Debug.Log("nombre red: "+profileinfo.profileName);
}
}
}
But when I try it on Android give me an error: ![DLL import error][2]
i've tried downloading and adding the DLL, but it's still the same. Any one has a clue? thaks!! [1]: http://managedwifi.codeplex.com/ [2]: /storage/temp/51332-errorunity.jpg
I don't think so you can get more than that. Native functions are not offering more on that.
Any luck with this in the end? I just need to know which wifi I am connected to.
Answer by PAHeartBeat · Jul 30, 2015 at 11:18 AM
Hi,
you need to write some platform spesisfic code need to use as plugin. you can also call use this one using c# (https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface(v=vs.80).aspx) but I am not sure its work or not in mobile device or console games.
here is another example but I fear it;s only support windows device (http://www.codeproject.com/Articles/35329/How-to-access-wireless-network-parameters-using-na)