0

Feedback from any native Android developer would be very helpful as no solution from Android developers thru Google Issue Tracker yet ticket.

WiFi is switched after requesting by the app thru WifiNetworkSuggestion, and it is in fact switched to that WiFi. However, the socket does not work and all requests go to the exception block possibly due to either the TCP communication pipe being blocked as the system detected this WiFi as no internet WiFI or bindToNetwork is not working and the WiFi in fact is not the primary, default network.

The used package is this: https://pub.dev/packages/wifi_iot Code example:

WiFiForIoTPlugin.connect(targetWiFiSSID, password: '12345678', joinOnce: false, security: NetworkSecurity.WPA, withInternet: false); WiFiForIoTPlugin.forceWifiUsage(true);

Implemented forceWifiUsage is for the same purpose to make it usable with no internet IoT communication WiFis. It binds the network as primary: manager.bindProcessToNetwork(network).

Reference links which discussed related issues and solutions previously: Android TRANSPORT_CELLULAR network not available if wifi is connected. How do we make it available? https://github.com/flutter/flutter/issues/30678

This behavior only happens in Android 12 and Android 13. Android 10, and 11 everything works well. For now, the only workaround is asking users to switch WiFi manually and wait for this system popup which is not the user-friendly way in comparison with : enter image description here

After a positive response for this popup socket will work normally.

Gwhyyy
  • 7,554
  • 3
  • 8
  • 35
Elmar
  • 2,235
  • 24
  • 22

0 Answers0