How to set wifi to Android Things without an ethernet cable or adb [closed]
Asked Answered
P

2

9

I'm interested in knowing how to set the first wifi on android things (not android phone) without access to a network cable, for a fresh install.

There certainly must be a way to put the information in the SD card right after copying the OS image. If that can't be done directly, worst case scenario I would expect it should be possible to write a script and copy it somewhere into some of the partitions and have it automatically run at boot (which can be handy for other things). Unless the image is signed?

I would also be ok by writing an app that could be copied to SD card before first boot that would be auto-installed and do that thing for me. I would know how to write the app, but so far I don't know how to do the copy/autoinstall/autorun thing.

I would also be ok having one device connect to network and configure wifi, then clone its SD card into another one.

What really gets in my way is having to get a network cable every time I prepare a new SD card.

Pave answered 18/1, 2017 at 23:11 Comment(3)
Alternatively, it is possible to connect to serial debug console as described here under the What if I have neither display nor Ethernet cable? sectionTudor
as for now, you can create your own Android Things image with your own bundle (your main apk, any other apk that will be accessible from your main apk, bootanimation.zip) from Android Things Console. There so it will be easier if your main apk containing connect to available wifi network functionality.Aviate
I plan to make a library that sets up a BLE connection and waits for a companion app on a phone to send wifi credentials. Put that library in either the IoT app or start it as a service, and bundle the app in the image in the console. That will make it useful to set up other things like language and timezone.Pave
V
9

You should be able to add your wifi configuration at the end of /data/misc/wifi/wpa_supplicant.conf.

network={
    ssid="SSID"
    key_mgmt=WPA-PSK
    psk="PASSPHRASE"
}

This should be located on the data (ext4) partition of the sdcard (for me /dev/sdb15)

Veil answered 19/1, 2017 at 0:56 Comment(4)
I could mount /dev/disk3s15 (equivalent to /dev/sdb15) as ext4 but only could find benchmarktest lost+found nativetest. I'll try later creating the folders there, I must go to something else now. Although I could find what appears to be the root partition at disk3s16 (sdb6), which also looks very promising. Thanks for mentioning ext4, that's what I needed to get the partitions mounted in first place.Pave
while accessing the wifi folder it says permission denied...Convulse
Has anyone had luck modifying the config files, such as this one, from an os x machine? I don't have any luck mounting the Android Things img for editing.Pedaias
OS X can't do it on itself, you'd either need a VM to boot a linux (painfull, I tried, you need extra instructions for writing to a partition from real sd card) or a paid tool that has experimental support for writing ext4.Pave
C
1

You can use:

adb connect Android.local

to connect to Android Things PC (Raspberry PI3) and then just set up your WiFi like described in Android Things tutorial:

$ adb shell am startservice \
    -n com.google.wifisetup/.WifiSetupService \
    -a WifiSetupService.Connect \
    -e ssid <Network_SSID> \
    -e passphrase <Network_Passcode>

https://developer.android.com/things/hardware/raspberrypi.html

Cadmus answered 20/1, 2017 at 13:4 Comment(1)
Please, read the question attentively!Tudor

© 2022 - 2024 — McMap. All rights reserved.