12

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

2 Answers 2

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.

0

It is possible to set up your Android Things device to advertise via Wi-Fi instead of Bluetooth. However, it would require custom implementation and cannot be done using the standard Android Things libraries.

One way to accomplish this would be to use a Wi-Fi Direct library, such as the Wi-Fi Direct API in the Android framework, to create a Wi-Fi Direct group on the device and advertise the device's name and IP address. The mobile app would then be able to discover the device and connect to it using the IP address. Once connected, the app could send the Wi-Fi credentials to the device using a custom protocol.

Another option would be to use a library such as the open-source Android-wifi-tethering library, which provides an easy way to enable tethering on Android Things devices.

It's important to note that, as you already mentioned, the Android Things platform is still relatively new and documentation and tutorials on this subject might be limited. It would be best to familiarize yourself with the relevant APIs and libraries and experiment with different solutions before choosing the best approach for your use case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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