How can I get a list of unknown and available WiFi networks?

I’d like a function to get a list of all WiFi networks currently in range and connect to one in that list without knowing the list ahead of time.

The project I’m working on is like a “message in a bottle” project where the particle needs internet access to report it’s location and it does this by finding an available wifi network which is open without any credentials.

The device would then attempt a connection to the cloud to send some data.

Is this possible with the current API?

Thank you.

Have you had a look at the docs?

e.g. WiFi.scan()