6

This should be really easy to find, but I've done a bunch of google searching and haven't found anything that works. On Linux, you just type hostname and it tells you, but that doesn't work on my phone.

I know I've changed the hostname in the past (was android-r at one point), but I don't remember how. All I want to do right now is see what it is, though, so I can connect to it without knowing the dynamic LAN IP address.

4
  • 1
    Related: How do I change the name of my Android device?
    – Firelord
    Commented Feb 27, 2016 at 23:28
  • 1
    @Firelord Ah, thanks. The GUI method also works for me: android.stackexchange.com/a/61512/693
    – endolith
    Commented Feb 28, 2016 at 0:14
  • Interesting. Which device and Android version are you using? I don't have that option in Developer options. May be because I'm using an age-old Android version.
    – Firelord
    Commented Feb 28, 2016 at 0:16
  • @Firelord It's specific to modded ROMs, just edited that into the answer
    – endolith
    Commented Feb 28, 2016 at 0:28

2 Answers 2

6

There's a way to retrieve your device's hostname, but you'll have to meet one requirement, which is to have a Terminal Emulator installed on your device.

Once you have one, just open an instance of the emulator and issue the following command, followed by Enter:

getprop net.hostname

Your phone will then answer with its hostname.

1
  • 2
    This will give me an empty line as answer. Typing in hostname gives me localhost.
    – Janusz
    Commented Oct 1, 2021 at 16:02
2

This depends on the device.
Some devices don't send their hostname to the router or that hostname is already used, so they are only reachable via their IP address or network local hostname (not device local hostname).

On Windows run tracert <ip> and you see the locally valid hostname of any device.

Example output:

1    94 ms     7 ms     9 ms  android-ce166eae64b93da4.fritz.box [192.168.178.24]´

So the hostname is android-ce166eae64b93da4.fritz.box for this specific network.
Usually the part in front of the network suffix (in this case fritz.box) is unique and works across networks (remember: only local).

2
  • yeah this didn't work for me, but I was hoping for something I could look at or run on the phone itself anyway
    – endolith
    Commented Feb 27, 2016 at 18:09
  • This worked correctly, as long as the IP address for the phone is known. This is extremely useful as my phone's IP changes a lot Commented Jul 26, 2019 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .