I have tried to open wifi by click on a button. but this seem to be not working even with permissions

public bool setWifiEnabled(bool enabled)
{
using (AndroidJavaObject activity = new AndroidJavaClass(“com.unity3d.player.UnityPlayer”).GetStatic(“currentActivity”))
{
try
{
using (var wifiManager = activity.Call(“getSystemService”, “wifi”))
{
return wifiManager.Call(“setWifiEnabled”, enabled);
}
}
catch (Exception e)
{
}
}
return false;
}

What do you mean by “not working” exactly? What are you expecting this code to do and what does it do instead? What debugging steps have you taken? Have you checked if you’re receiving an exception and logging it in your catch block?