11

I need to send Wi-Fi credentials to my Android Things headless device via a mobile app. As it is right now, the device advertises on Bluetooth, the mobile app connects to device and sends Wi-Fi credentials to it. The device then stops advertising via Bluetooth and connects directly to the users Wi-Fi network using the credentials acquired via Bluetooth.

Is it possible to set up the device to advertise via Wi-Fi instead of Bluetooth? If so how could this be done? I can't find any information or tutorials on the subject probably because android things is still relatively new.

Looking for any advice/libraries/tutorials to send me in the right direction.

5
  • Are you planning to use an open Wi-Fi or some sort of pre-shared key?
    – Helmar
    May 31, 2018 at 19:40
  • @Helmar open Wi-Fi should be enough? but if there is away, please dont hold back, the more knowledge the better... May 31, 2018 at 21:31
  • Maybe android.stackexchange.com/could help? Jun 1, 2018 at 8:15
  • 2
    Perhaps, this could help: iot.stackexchange.com/a/658/3141 Also have a look at the linked article in the answer.
    – pan
    Jun 4, 2018 at 11:16
  • 1
    What's the motivation to go from Bluetooth to wifi? I'd love to see how you got Bluetooth working to get wifi from an app.
    – Loran
    Nov 16, 2018 at 2:31

1 Answer 1

0

You can use smart-config from ESP-IDF

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_smartconfig.html

This is the best method to advertise wifi credentials to embedded devices. It uses UDP to broadcast wifi credentials to all surrounding devices, but there is a catch to it. it is not encrypted and so not secure, but adding mbedtls to your project you can implement DTLS to encrypt the UDP packets

https://mbed-tls.readthedocs.io/en/latest/kb/how-to/dtls-tutorial/

There is a lot of documentation about smart-config and dtls both for the app and the device side.

You can try provisioning which is easier but more of struggle for user experience. you host an access point and a webserver that catches credentials from the app you can use POST/GET requests to send/receive and when the device catches that it switches mode and try to connect with received info.

there is examples all over the internet I provide all viable choices and you chose which suit your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.