Hi,
I'm building an app where I need to know the wifi info like the ssid. Until android 8 it worked fine, but since I update to android 9 it gives back "unknown_ssid".
I used a Dependency:
This is the interface in the PCL:
public interface IWlanInfo
{
string GetCurrentSSID();
string GetCurrentBSSID();
bool GetCurrentIsHidden();
}
This is the implementation at the droid project:
[assembly: Dependency(typeof(DroidProject.Droid.WlanInfoAndroid))]
namespace DroidProject.Droid
{
public class WlanInfoAndroid : IWlanInfo
{
public string GetCurrentBSSID()
{
return ((WifiManager)Android.App.Application.Context.GetSystemService(Context.WifiService)).ConnectionInfo.BSSID;
}
public bool GetCurrentIsHidden()
{
return ((WifiManager)Android.App.Application.Context.GetSystemService(Context.WifiService)).ConnectionInfo.HiddenSSID;
}
public string GetCurrentSSID()
{
return ((WifiManager)Android.App.Application.Context.GetSystemService(Context.WifiService)).ConnectionInfo.SSID;
}
}
}
And this is how I call it at the PCL:
var ssid = DependencyService.Get<IWlanInfo>().GetCurrentSSID().Trim('"');
var bssid = DependencyService.Get<IWlanInfo>().GetCurrentBSSID();
var isHidden = DependencyService.Get<IWlanInfo>().GetCurrentIsHidden();
Does anybody know how I can make it work again?
Thanks in advance!