I have a simple problem with my phone: When I get disconnected from a wifi hotspot, my phone doesn't automatically reconnect because it always thinks there is no Internet. This is because of my firewall. I'm guessing that Android phones try to ping a server to check if there is an Internet connection.
So what I'm currently trying to do is to write a simple script that constantly scans for Wifi networks until it finds one that I have been connected to in the past.
It would probably be a really simple script, but I just can't find a method to actually connect to an access point.
import threading
import androidhelper
droid = androidhelper.Android()
knownAPs = ["home-wifi","workAP"]
def autoConnect():
threading.Timer(5.0, autoConnect).start()
droid.wifiStartScan()
nearbyAPs = droid.wifiGetScanResults().result
for i, curAP in enumerate(nearbyAPs):
if curAP['ssid'] in knownAPs:
# ?connect to a wifi?
autoConnect()
Am I missing something in the docs? Any idea how I could accomplish this?
Edit:
Allegedly it is possible to use the Kivy library in QPython. I couldn't find an example of how it could be accomplished though. But maybe the problem could be solved like that?