コード
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);
var connectButton = FindViewById<Button>(Resource.Id.ConnectButton);
var wifiStatusText = FindViewById<TextView>(Resource.Id.WifiStatusText);
connectButton.Click += (sender, args) =>
{
using (var wifiManager = GetSystemService(Context.WifiService) as WifiManager)
{
wifiManager.StartScan();
wifiStatusText.Text = "Wifi の接続状況\n";
wifiManager.ScanResults.Where(result => !string.IsNullOrEmpty(result.Ssid)).Select(result => $"SSID: {result.Ssid} 接続レベル: {result.Level} \n").ToList().ForEach(s => wifiStatusText.Text += s);
}
};
}
実行結果