21
Jan
WiFi credentials in a QR code
It’s possible to encode your WiFi credentials into a QR code. This page on ZXIng’s encoder lets you choose the right options and generate a code that works on Android. It ends up linking to the Google Charts API page for the code, so it’s fairly easy to reverse engineer. The unescaped Google Charts URL looks like this:
http://chart.apis.google.com/chart?cht=qr&chs=350x350&chl=WIFI:S:ssid_here;T:WEP;P:wep_password_here;;
Doing a little reverse engineering of the results gives us the following string format:
WIFI:S:<ssid>;T:<wep |WPA>;P:<password>;;
So, all you need to do is stuff that into the Google Charts API (per above) and you get a code, that when scanned, allows you to easily connect to your local WiFi network. Cool!
Here’s an example code:
If you prefer not to use Google’s API (say, for example, that you plan on generating lots of codes and would rather do so locally), there is a Debian/Ubuntu package called “qrencode” that will take any valid URI string, including the above WiFi credentials, and output a PNG file. Obtain it with “sudo apt-get install qrencode” and then peruse the associate man page with “man qrencode”; you’ll be creating QR codes in mere seconds.
You can also use Easy Wifi Connect ( https://market.android.com/details?id=com.orange.labs.easywificonnect ) to scan this kind of QR Code… Very useful app.
I’ve created my own Wifi QR-Code (with the libqrcode PHP binding ) and at 1st glance this works fine: when I scan the code with the Zxing barcode scanner the code is properly detected, and offered to connect to the network; I press the button to connect, and that works too; then when I check the wireless settings I see that a new entry was made with the name (SSID) of my network, state of encryption, and connected …
however once I switch off WLAN, and later on again this entry doesnt connect automatically, and when I try to manually connect then it asks for the password (PSK).
If I create the connection manually then it works permanently. So seems to me that QR-Code credentials are handled as a one-connect-only thingy, and the password isnt stored permanently; someone else observed such behavior?
My phone has Android 2.3.3.