Android Things: Connecting To Network Without Ethernet Cable
Android Things is Google’s foray into the Internet of Things(IoT) world based on Android Frameworks. As of now, Google support 3 hardware platforms.
Google’s documentation on connecting to the WiFi network requires you to have a Ethernet cable to setup WiFi which defeats the purpose of being wireless in the first place. I have not seen any posts with regards to connecting WiFi on first boot except for this stackoverflow thread. It will work on Android devices but not on Android Things since creating /data/misc/wifi/wpa_supplicant.conf on Android Things will be overwritten by /system/etc/wifi/wpa_supplicant.conf on first boot. (I tried it, heh)
For this tutorial, I am using a Raspberry Pi 3.
Append the following network parameters to /system/etc/wifi/wpa_supplicant.conf
Change the above to suit your needs. If in doubt, copy wpa_supplicant.conf from your Android device(if you have root). Save the file and insert the SD Card into your IoT device and we are ready to go! To connect to your IoT device, you will have to know it’s IP Address. However, if your computer has Zeroconf software installed,
adb connect Android.local
will connect to your IoT device.
What is the Zeroconf software you are talking about?
If you are on a Linux distribution, download Avahi-daemon from your package manager. If you are on a Mac, Bonjour should be installed. For Windows users, you can download Bonjour from Apple’s itunes installer. If you do not want to install itunes, unpack the itunes installer file and you will find a Bonjour installer in it.