-
Notifications
You must be signed in to change notification settings - Fork 197
Description
wifi_iot 0.3.18+1
withInternet false
android 12
I connect to an AP with no internet so withInternet = false, I accept the popup to connect to the wifi
then I can see a brief connected popup.
After the connect API I also call forceWifiUsage(true)
From the AP I can see that my phone is connected and I can even ping it
adb shell commands show also that I'm connected to the asked wifi
adb shell cmd wifi status
Wifi is enabled
Wifi scanning is always available
==== Primary ClientModeManager instance ====
Wifi is connected to "XXXXXXXXX"
WifiInfo: SSID: "XXXXXXXXX", BSSID: XX:XX:XX:XX:XX:XX, MAC: YY:YY:YY:YY:YY:YY, Security type: 2, Supplicant state: COMPLETED, Wi-Fi standard: 4, RSSI: -50, Link speed: 65Mbps, Tx Link speed: 65Mbps, Max Supported Tx Link speed: 72Mbps, Rx Link speed: 65Mbps, Max Supported Rx Link speed: 72Mbps, Frequency: 2437MHz, Net ID: 85, Metered hint: false, score: 0, CarrierMerged: false, SubscriptionId: -1, IsPrimary: 1
successfulTxPackets: 16
successfulTxPacketsPerSecond: 3.3097908512005812E-6
retriedTxPackets: 1
retriedTxPacketsPerSecond: 1.707389040735719E-21
lostTxPackets: 0
lostTxPacketsPerSecond: 0.0
successfulRxPackets: 3
successfulRxPacketsPerSecond: 6.709064673536853E-23
adb shell ifconfig
rmnet_ipa0 Link encap:UNSPEC
UP RUNNING MTU:9216 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
lo Link encap:UNSPEC
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope: Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2268703 errors:0 dropped:0 overruns:0 frame:0
TX packets:2268703 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1795765448 TX bytes:1795765448
wlan0 Link encap:UNSPEC Driver icnss
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: XXXX::XXX:XXXX:XXXX:XXXX/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:753808 errors:0 dropped:0 overruns:0 frame:0
TX packets:160800 errors:0 dropped:7 overruns:0 carrier:0
collisions:0 txqueuelen:3000
RX bytes:872186321 TX bytes:64962198
dummy0 Link encap:UNSPEC
inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope: Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:2940
All seems to be ok, but I'm not able to communicate on the network, not even able to ping the gateway
adb shell ping 192.168.0.1
connect: Network is unreachable
Http requests failed with 111 errno
I/flutter ( 1481): Error: SocketException: Connection refused (OS Error: Connection refused, errno = 111), address = 192.168.0.10, port = 40148
If my understanding of the android wifi specifications is correct, android offer 3 APIs to connect to wifi
- Suggestion API : To connect to a classif AP wifi with internet connection. This is implemented when we use wifi_iot connect with "withInternet" set to true.
- Network request API: A peer to peer connection. This is implemented when we use wifi_iot connect with "withInternet" set to false. But to use this mode we cannot connect to classic AP. We should rather connect directly to the device that should support the P2P mode.
- ACTION_WIFI_ADD_NETWORKS API: To connect to an AP with user approval. This is what I'm looking for and this mode should solve my problem. But I'm not able to make it work. When I look into the wifi_iot code I can see that "registerWifiNetwork" fullfill android requirement to use this mode but I'm always getting false when I call registerWifiNetwork.
Anyone can help to make it work please ? Any suggestations ? Should we really use registerWifiNetwork and how ?