29

I see names of computers in my router's DHCP leasing list. My android galaxy tab is listed under an alphanumeric name. How do I set a friendly name that I like?

24

You can change the hostname to a less cryptic name in the Developer Options under Settings. Under the "Debugging" section in the Developer Options you will see an option called "Device hostname" which should currently be set to this rather cryptic name. You can change it to any alpha numeric name you like.

If you are on Android 5.0 that option is not there anymore. Though using the ADB shell still works. See this answer: How to set friendly network name of android computer? Root doesn't seem to be required on my phone. From the answer linked above without acquiring root access:

adb shell
getprop net.hostname
setprop net.hostname <new_hostname>
  • Sadly this option does not appear on a Bionic running rooted stock ROM 4.1.2. – ericx Jul 17 '14 at 16:00
  • 1
    Worked like a charm on my S3 running Cyanogenmod. :) – Ƭᴇcʜιᴇ007 Jan 15 '15 at 17:10
  • 4
    This option is not available anymore since Android 5.0. – bk138 May 20 '15 at 19:47
  • You can try @bayuah answer. I tried it and works without root access on my Android 5.01 phone. – PTS May 20 '15 at 21:17
  • 4
    The adb method doesn't seem to work on Android 5.1 (and no option to use su for me, it says "/system/bin/sh: su: not found"). Tested on Moto E 2nd Gen with adb v1.0.32. – David Jan 6 '16 at 20:51
14

Open terminal. Enter the following:

adb shell
su
getprop net.hostname
setprop net.hostname <new_hostname>

Root access is required.

  • 1
    it's sad that with no root access, it doesn't complain when you invoke setprop, it just doesn't take effect (checked with getprop). Also su fails for me: "/system/bin/sh: su: not found". Is that an indicator of device not rooted or that the device doesn't offer an su option? Or is this something missing in my ADB install? – David Jan 6 '16 at 20:57
  • Yes. It's either your device isn't support root access or you aren't manually rooting the device yet. – bayuah Jan 6 '16 at 22:35
  • @David: "Is that an indicator of device not rooted or that the device doesn't offer an su option?" - Those are the same thing. A rooted device gives you the su command to gain root privileges from a shell; a non-rooted device doesn't have that command. – Micheal Johnson Apr 29 '16 at 6:33
  • @bayuah - I can do this by opening a terminal program on my phone. All the above commands work, and getprop ... returns the new hostname, even when I exit out of the su; but the hostname that is broadcast does not change, and it doesn't stick when I reboot. Thoughts? – Diagon Jun 28 '16 at 17:31
  • 1
    One note4 6.0, the value gets reset after reboot. – Abhishek Anand Jul 5 '16 at 18:24
4

In some Android phones, you may change in Wi-Fi Direct

  1. Settings
  2. WiFi
  3. Top right menu > Advanced
  4. Wi-Fi Direct
  5. Top right option Rename device
  6. Write your new device name and press OK
  7. Turn off and on your Wi-Fi
  8. If it has no effect, restart your phone.

Important: Not all Android phones have this option, and not all phones modify their hostname correctly, even after modifying the device name from that option.

  • About the downvote, if possible, please explain the reason. – Paulo Coghi Mar 18 at 11:18
  • Thanks for this answer! Unfortunately I found it only after I changed hostname using su & setprop, but it is great to know this option is available. – MarSoft May 14 at 0:08
1

Just wanted to reference another related solution I came across using ADB (and requires rooted device): http://nileshgr.com/2012/10/13/how-to-change-wifi-host-name-of-your-android-device. I would however prefer the ADB commands presented here on SO than this link, but it's another method at least.

  • Only method I found that still works. Other answers get clobbered on reboot, or simply don't work at all. – Hugh Jeffner May 11 '17 at 19:52
0

The name that is sent to the DHCP server is not the hostname as is commonly thought, it's the VID (Vendor ID Code) which you cannot change. You could try changing the name at the router level if possible.

  • Is it possible to set hostname? Is it possible to set any name on Android? – Suzan Cioc Apr 4 '12 at 17:15
  • You should be able to change it in the settings, otherwise rooting it will allow console access and you could change it through there. – paradd0x Apr 4 '12 at 18:07
  • I can find only Bluethooth name setting. Can you please point where other name settings can be located? – Suzan Cioc Apr 5 '12 at 10:11
  • This is crazy, why are people down voting the truth ? – Rohit Gupta Jul 29 '16 at 4:19
0

This solution is using the commands posted by @bayuah above, but not using adb nor su at all. This is on a rooted device (Nougat AOSP 7.1.2). Using JuiceSSH terminal, enter two commands:

getprop net.hostname
setprop net.hostname <new_hostname>
0

All above mentioned options can not stay after phone reboot Just did ADB-->setprop Work good! Net name is changed BUT! After phone reboot - net name is the same (old one_)

-3

Simply download and install the app called "Change Hostname" from the Play Store and enjoy editing your android device hostname (android-xxxxxxxxxxx).

Root access is required though, sorry for the non-rooted users.

Regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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