- Home /
Question by
MiroslavShard · Jan 21, 2020 at 07:16 PM ·
androidnetworkjava to c#
Get a list of Wi-Fi networks (SSID),
Hi!
I am working on a non-gaming application for Android and I have a problem. I need to get a list of string in which there will be all available Wi-Fi networks (preferably only 2.4 GHz). I already have a script that scans the Wi-Fi network to which the device is connected, but this is not what I need
Here is the main part of the script:
string SSID = "";
try
{
using (var activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"))
{
using (var wifiManager = activity.Call<AndroidJavaObject>("getSystemService", "wifi"))
{
SSID = wifiManager.Call<AndroidJavaObject>("getConnectionInfo").Call<string>("getSSID");
}
}
}
catch (Exception ex)
{
Debug.Log(ex);
}
I also found ready-made solutions to my problem on the Internet, but they are only for Android Studio (Java), so if you can convert code from Java to Unity C# it would be great help!
Google's tutorial
,
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612221912im_/https://answers.unity.com/themes/thub/images/avi.jpg)