ThanosFisherman / WifiUtils

Easily Connect to WiFi Networks
Apache License 2.0
731 stars 188 forks source link

Support for Wi-Fi suggestion API on Android Q (10) #92

Closed Minuit-Z closed 2 years ago

Minuit-Z commented 3 years ago

As wifi-suggect said:

Devices running Android 10 (API level 29) and higher allow your app to add network credentials for a device to auto-connect to a Wi-Fi access point. You can supply suggestions for which network to connect to using WifiNetworkSuggestion

we can use WifiNetworkSuggestion api to connect wifi on Android Q+. but I think it`s not friendly for developers . we can just provider a suggestion to tell the system: I wanna connect this ssid. Then the system would receive it " at a right time " .

I tried this way many times , but this method works by accident. when it works , the system would send a notification for users to choose weather we use " this suggestion ". Uses may ignore such a suggestion or choose to reject .

ThanosFisherman commented 3 years ago

WiFiUtils is currently using the IoT API for connecting to wifi networks which limits the internet connectivity only to the app that requested it.

I haven't really studied the suggestion API yet but it seems like a good alternative although it might have its limitations as well. I think it's worth a try migrating to suggestion API once I get the hang of it.