Sujet : Re: home screen icon to connect to wi-fi network
De : enrico (at) *nospam* papaloma.net (Enrico Papaloma)
Groupes : comp.mobile.androidDate : 02. Oct 2024, 00:39:56
Autres entêtes
Organisation : Gegeweb News Server
Message-ID : <vdi18c$28o$1@news.gegeweb.eu>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1?Content-Type: text/plain; charset=UTF-8; format=flowed
On 9/30/2024 10:04 AM, Andy Burns wrote:
Enrico Papaloma wrote:
If no app exists, that's fine - but the COMMANDS must be happening on the
phone, and therefore that series of commands must be known to somebody.
Do you have any advice as to how to find what those commands are to connect
to a known access point when that access point is hidden.
I did have a look at the APIs
<https://developer.android.com/reference/android/net/wifi/WifiManager>
But I couldn't find a straightforward call like
wm = getSystemService(WIFI_SERVICE);
wm.setWifiEnabled(true);
wm.connectToSSID("whatever");
It might require code like this
<https://gist.github.com/cp-radhika-s/74d2eb717bad62f39d28a8727708af9c>
Thanks for that link to the wifimanager developer reference.
This might be what is needed but it might only pick & not connect.
ACTION_PICK_WIFI_NETWORK
Activity Action: Pick a Wi-Fi network to connect to.
This might provide enough information about the connection to force it.
EXTRA_WIFI_INFO
The lookup key for a WifiInfo object giving the information about the
access point to which we are connected.
This might be misused to force the connection to a known bssid.
EXTRA_BSSID
The lookup key for a String giving the BSSID of the access point to which
we are connected.
BTW, I wasn't aware of a connect to multiple access points simultaneously.
WIFI_MULTI_INTERNET_MODE_MULTI_AP
Wi-Fi simultaneous connection to multiple internet-providing Wi-Fi networks
(APs) is enabled.
There's a lot to dig through. I'll start with these breadcrumbs to follow.
reassociate()
This method was deprecated in API level 29. a) See
WifiNetworkSpecifier.Builder#build() for new mechanism to trigger
connection to a Wi-Fi network. b) See
addNetworkSuggestions(java.util.List),
removeNetworkSuggestions(java.util.List) for new API to add Wi-Fi networks
for consideration when auto-connecting to wifi. Compatibility Note: For
applications targeting Build.VERSION_CODES.Q or above, this API will always
return false.
There is also a lot to dig through on the link for connecting to a Wi-Fi
connection which might not have internet.
https://gist.github.com/cp-radhika-s/74d2eb717bad62f39d28a8727708af9cThat code seems to be something that might work if I can create an app in
Android Studio to run it, then I'll see if I can tweak it after getting it
to work (if it works) as I'm not all that good with Android Studio yet.
Lots of homework for me to dig through. Thanks!