android – Share WiFi-Settings as QR-Code for WPA2 Enterprise-ThrowExceptions

Exception or error:

I have found several sources describing a String Format used to describe WiFi-Access Settings in the form of:


(example taken from zxing documentation)

For basic WPA-Connections, this works just fine on my Android Device using the Zxing-Barcode-Scanner-App. However, I have been unable to find a way to embed WPA2/EAP-Connection Settings (Also referred to as WPA2 Enterprise) into a scannable 2D-Code. As I expected, inserting “L” (Login), “N” (Name) or “I” (Identification) Parameters at random positions did not really bring any advance.

Has anyone here succeeded in “embedding” WiFi-Connection Settings into a 2D-Scannable Code to work with an Android device?

Thanks for your help!

How to solve:

I found some information on how to format the WiFi config string in the following pull request at the github page of the zxing library project:

The first post contains a template of the string format, including an error (the prefix AI: is wrong, it must read A:, see here). The correct format according to the source is thus:

WIFI:T:WPA2-EAP;S:[network SSID];H:[hidden?];E:[EAP method];PH2:[Phase 2 method];A:[anonymous identity];I:[username];P:[password];;

When I tried this (using the command line tool qrencode) my Barcode Scanner app crashed. After some trial and error I figured that the option for hiding the SSID can be left out:

WIFI:T:WPA2-EAP;S:[network SSID];E:[EAP method];PH2:[Phase 2 method];A:[anonymous identity];I:[username];P:[password];;

With this I’m getting a working entry in the list of known wireless networks in Android 8.

As of now there is no support for declaring a certificate and the respective domain. If this is needed, one can specify it later by adjusting the settings from inside Android’s WiFi menu.

Leave a Reply

Your email address will not be published. Required fields are marked *