how to connect to specific wifi in xamarin ios

kefikefi Member ✭✭✭

NEHotspotConfigurationManager wifiManager = new NEHotspotConfigurationManager();
var wifiConfig = new NEHotspotConfiguration(ssid, password, false) { JoinOnce = true };
wifiManager.RemoveConfiguration(ssid);
wifiManager.ApplyConfigurationAsync(wifiConfig);
wifiManager.ApplyConfiguration(wifiConfig, (error) =>
{
if (error != null)
{
Console.WriteLine($"Error while connecting to WiFi network {ssid}: {error.Description}");
}
});
return true;

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    What errors are you facing? I noticed you used two ways to apply the configuration. Which of them makes you confused about?
    Moreover, if you want to utilize NEHotspotConfigurationManager do not forget to enable the Hotspot Configuration in the entitlements.plist.

  • kefikefi Member ✭✭✭

    Hotspot Configuration is enabled already and error is : Internal server error code 8

  • LandLuLandLu Member, Xamarin Team Xamurai

    Please check if this wifi can be accessed under your current environment. Check the validation of the ssid.

  • kefikefi Member ✭✭✭

    Error Domain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.}

  • LandLuLandLu Member, Xamarin Team Xamurai

    @kefi Have you enabled the Hotspot Configuration in the Entitlements.plist?
    And you have to add this capability to your App ID on the Apple developer portal.
    Do not forget to create the corresponding provisioning profile on that website.

Sign In or Register to comment.