Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get previously associated wifi networks?

Tags:

android

Is there any way to get the previously associated Wifi networks for an Android device? Ultimately, I want to bring up a list (e.g., a spinner) that has all of the networks that the user has associated with. Then, I want them to select their "home network." However, I can't find a history of associations. The history must be kept somewhere, because I can bring up my "Wi-Fi settings" and I can see my previously associated networks. They just say "Not in range" below them.

I checked WifiManager but couldn't find anything related there.

I do notice that there is a history in a root-only location (likely because the network's passwords are in cleartext):

data/wifi/bcm_supp.conf

I'd like a non-root method.


Edit: I now know it's possible. If you download the app called "Wifi Manager" from the Market or Google Play, you can pull down the dropdown menu to "Known networks" and they will come up. I've scoured all of the networking documentation and I still can't find out how, however.

like image 294
gnychis Avatar asked Jan 17 '23 06:01

gnychis


1 Answers

What you are looking for is: https://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks()

This will get you all the previously associated networks as they will have to have been configured in order to connect to them.

like image 91
Cheesebaron Avatar answered Jan 28 '23 02:01

Cheesebaron