🔄 Auto Connect WiFi (V6, power friendly)

This program scans & connect to any open or pre-configured WiFi network without user interaction, it also tries to keep the connection as long as the connection is strong (signal > 10%), otherwise it scans for another stronger network (5 retries).If there are no nearby networks it disables WiFi but periodically activate WiFi and scans for available networks.

I hope I have designed this program to be reliable and very power friendly, I would like to disable Mobile Data when WiFi is connected, but that require root.

Security concern:This program connects to ANY open WiFi network, if someone has setup some kind of malicious WiFi network without password, then this program will connect to it anyway (unless another open network has stronger signal).

All feedback is much appreciated!

Search tag: [SN]

changelog:V2. (2016-04-09)* Corrected a bug with the reconnect function.* Added some logging output* Had to change the WiFi strength function to a timer system, from a sensor system because the sensors didn't trigger in some situations.

V3. (2016-04-09)* Updated the code to use the new Go To Blocks instead of having lines all over the place.

V4. (2016-04-10)* added longer pause time before when the signal is strong.* more logging messages so you know what the app is doing.

V5.* changed the scan/connect function so it doesn't make an infinite loop into itself, but instead loops out into the rest of the program so the program can sleep if no networks are available.* Changed the long delay when no network is available to a sensor system: if screen is off it waits until it's turned on, otherwise it retries directly. (changed in V6)

V6.* Added a ping check to make sure that the new or re-established connection actually works too.* added the long sleep function again if no network are available, but only when screen is on, if the screen is off it still waits until it is turned on then restarts the scanning.