Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share Wifi credentials via NFC tag without special apps

I am looking for a way to create a NFC-tag that shares the wifi credentials of my network without my guests having to have any special NFC apps on their phone (other than whats coming with the phone). I have been looking at apps and services like NFC Tag Writer, WifiTap, NFC Task Launcher and NFCLabels.com, but it seems to me like it I would need to have the apps on the guest mobile as well to be able to use it, but I am not able to test it as I only have one NFC-enabled phone available. (Yes, I know, twisting my brains for nothing, but heck, weird behaviour is nothing new...)

My closest clue is that WifiTap states that:

The app processes URIs in the format of wifi://[network ssid]/[wep|wpa|open]/[network key]

If this is actually universal this would mean that I could do what I what I want to, but I have not found any confirmation on this. So, how could what I want be done and am I on the right track with the clue from WifiTap?

like image 335
Christian L Avatar asked Apr 09 '12 23:04

Christian L


People also ask

Can you share Internet with NFC?

Instead of having to tell your wireless password to each person that needs access for their smartphone or tablet, just try using this simple app.


2 Answers

As Alex wrote in a comment, you can now (since Lollipop) write a tag containing Wi-Fi credentials directly from the Android Wi-Fi settings: long-tap a network → Write to NFC tag.

It seems to be an NDEF-formatted tag with the application/vnd.wfa.wsc MIME type and a "WPS NFC" token.

The relevant source code can be found in platform/packages/apps/Settings/src/com/android/settings/wifi/WriteWifiConfigToNfcDialog.java.

like image 150
Bruno Parmentier Avatar answered Sep 18 '22 16:09

Bruno Parmentier


There is an official standard for this kind of situation: NFC Forum Connection Handover Technical Specification. However, this is currently not supported by Android. I don't think there is currently any way to transfer WiFi credentials using NFC without the help of a dedicated app.

One way of going about this is to create (or find) an app in the Google Play Store that has the following properties:

  1. Intent filter for ACTION_NDEF_DISCOVERED and as URI the URL of the app in the Play Store.
  2. Intent filter for ACTION_NDEF_DISCOVERED and as type some proprietary type (e.g. a MIME type)

Then you can create tags with an NDEF message containing the following NDEF records:

  1. SmartPoster record with Play Store URI and some descriptive text (e.g. name of the app)
  2. Record of proprietary type containing the WiFi credentials
  3. Android Application Record for the app

The 3rd record will make sure that the proper app will always be started or the device user will be redirected to the Play Store to install it. This works only on ICS, however, but the 1st record (combined with the 1st intent filter) serves the same purpose on Gingerbread.

like image 45
NFC guy Avatar answered Sep 20 '22 16:09

NFC guy