Post

Replies

Boosts

Views

Activity

Force HTTP calls go over WIFI network on Xamarin iOS
I have an app, developed in Xamarin Forms, which connects programmatically to a WIFI (with no internet access) exposed by an IoT device. This is the code I use to connect to the wifi network: NEHotspotConfiguration configuration = new NEHotspotConfiguration("ssid"); Device.BeginInvokeOnMainThread(() => { NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(configuration, (NSError error) => { if (error != null) { if (error.LocalizedDescription == "already associated.") { // connected! CommunicateConnected(); } else { // not connected CommunicateNotConnected(); } } else { // connected! CommunicateNotConnected(); } }); }); Once the connection is successfully established the app performs some HTTP calls to the IP of the IoT device. Sometimes it happens that the HTTP calls go over the cellular data connection instead of WIFI connection (because the joined network has no internet connection?) and they fail. (Simply, I see that the 4G icon is still visible instead of the one representing the WIFI connection). The switch between mobile connection and WIFI connection, in these cases, happens after some minutes. Is there a way to force the HTTP calls to go over the just joined network?
3
0
1.6k
Feb ’22