Avoid "The Wi-Fi network does not appear to be connected to the internet" prompt on iOS

615 Views Asked by At

I am developing an app in Xamarin Forms, which connects to some IoT devices which do not have an Internet connection available.

The IoT device expose a free WIFI hotspot to which the app connects. On iOS side, to perform the connection I use the NEHotspotConfigurationManager.SharedManager.ApplyConfiguration method with a NEHotspotConfiguration object. This is the part of the code I use to perform the connection:

NEHotspotConfiguration configuration = new NEHotspotConfiguration(ssid);
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(configuration, (NSError error) =>
{
    if (error != null)
    {
         if (error.LocalizedDescription == "already associated.")
         {
             return true;
         }
         else
         {
             return false;
         }
    }
    else
    {
         return true;
    }
});

Everything works fine, the app successfully connects the IoT device and I am able to interact with it once the connection is established. But sometimes a prompt is shown informing that The Wi-Fi network "name-of-wifi" does not appear to be connected to the internet. Do you want to temporarily use cellular data?

Is there any way to avoid this prompt to be shown. I read that setting joinOnce to true in the NEHotspotConfiguration object could to the trick but, with this flag = true, once the app is put in background the connection with the IoT device is interrupted.

Is it possible to leave joinOnce set to false and avoid the prompt mentioned above?

0

There are 0 best solutions below