riggaroo
riggaroo

Reputation: 2997

Android Things - How do I connect to my Raspberry Pi when I don't know the IP address

I have successfully managed to install the Android Things Dev Preview onto my Raspberry Pi.

I have a problem though. When I first started installing my own applications I was able to connect to the Raspberry Pi through Ethernet, because it displayed the IP address on the TV when I booted up the Raspberry Pi.

Now because I have the Raspberry Pi already running an application, when I boot it up, it is automatically booting into my application without showing the initial screen with the IP address (and I forgot my IP address 🤔).

Is there an easy way to get the IP address of the Raspberry Pi, or connect to it when I don't know the IP address? Even a command to get a list of all available ADB devices on the network would help.

It would be great if when connected to a certain Wi-Fi, you could run something like:

adb network devices

Which could give a list of ADB devices on the network you are on.

Upvotes: 16

Views: 5525

Answers (7)

Reza Hosseini
Reza Hosseini

Reputation: 154

I had the very same problem recently and the easiest way in my opinion is that to just install a simple app on your phone (in my case Fing) that shows all the connected devices to your local connection including th RPI with their ip address. So then you are good to go!

Upvotes: 3

Martin
Martin

Reputation: 177

The easiest way how to get to the initial screen with IP address from your application is to connect a USB keyboard to your Raspberry Pi then pressing escape key once :)

Upvotes: 3

Fabio
Fabio

Reputation: 2824

On OS X you can scan for all devices that publish itself as Android.local

dns-sd -Q Android.local

I believe you need Bonjour on Windows/Linux to get something similar, but I'm still not familiar with them.

After figuring out the correct IP for the desired device you can connect as usual:

adb connect <ip-address>:5555

Upvotes: 4

CkurtM
CkurtM

Reputation: 195

You can scan your network for points with ports 5555/5554 open, for example,

nmap -p 5555,5554 192.168.0.2-100

will scan in range 2-100 for any IP addresses with those ports open.

Upvotes: 12

Boy
Boy

Reputation: 7497

Or you can check in your router which devices are connected

Upvotes: 4

Kamil Ślesiński
Kamil Ślesiński

Reputation: 170

If multicast DNS is not supported on host platform and you have access to your router, you can simply log into it and view the list of connected devices. You will be able to view all the devices no matter if mDNS is available or if there are any ports opened on the device (or if you don't know which port is opened).

Upvotes: 3

riggaroo
riggaroo

Reputation: 2997

The Raspberry PI Automatically broadcasts Android.local and should resolve to the IP address assigned to your Pi on port 5555. Running the following:

adb connect Android.local

The command above is effectively the same as running:

adb connect <ip-address>:5555

Note: This will only work if your host platform supports multicast DNS service discovery.

This information was found in the documentation here by step 7 https://developer.android.com/things/hardware/raspberrypi.html

Upvotes: 23

Related Questions