Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

My Android device is the Nexus One. But this should apply to all current Android devices.

How do I change the name of my Android device?

When I connect to my wireless router's client tables, my android devices is listed for example as: android_1234567890abedfc. I'd like to give it a more readable name.

share|improve this question
    
It's also possible to configure the hostname via the DHCP server. But I haven't checked if android uses this configuration option. It's anyways just a cosmetic option. –  Flow Nov 30 '11 at 16:34
    
    
@Flow (Varies but) Android DHCPCD does not have the dhcpcd-run-hooks for setting the hostname from DHCP. Atleast on my Samsung Froyo device. It doesn't have the ntp hooks either. DHCPCD does support it though. –  cde Jan 4 at 14:31
add comment

8 Answers

[Settings] > [Developer Options] and scroll down to "Device Hostname". Root not need.

Screenshot example: http://imgur.com/1Uk6I40

share|improve this answer
    
What device is this screenshot from? I've never seen one with this option. –  Dan Hulme Feb 25 at 22:45
add comment

Another way you can change the hostname involves using adb. You'll need root to change it this way as well, but it's much more convenient if you use adb. It's linked here: http://stackoverflow.com/a/12521454/198348

> ehtesh@x200arch:~$ adb shell
> su #(to gain superuser access)
> getprop net.hostname #(this should display the current network name)
> setprop net.hostname <newhostname>
share|improve this answer
add comment

Depends on which version of Android you have. Newer versions will use the right build.prop entry. Well, that is to say, Android reads the build.prop as it's normal boot process. Once the Connectivity Service runs, it checks to see if net.hostname is set in the Settings, then if empty, then it uses the "android_" + (permanent) android ID. So that's all you need to do. Add net.hostname=HOSTNAMEHERE to /system/build.prop. Leave a blank line at the end of the file.

Older versions, Gingerbread, Froyo, etc, just clobber it. It doesn't bother to check. It will set net.hostname to android_24412414... no matter what. So you will need to change it after that Connectivity Service has finished loading. Luckily, it only runs the startup once, not on every new connection. So we just need to run setprop net.hostname HOSTNAMEHERE after that for it to stick. Unfortunately, it runs fairly late in the boot process, so you need something that will make the changes on boot_complete. Most likely an App that runs by itself.

But then there is another issue. The net.hostname setting, is not copied to the entire system! If you use a console/terminal application, you might not get the same hostname. My phone, a Samsung Sidekick 4G (semi-Galaxy S based) has an init.rc which runs hostname localhost, so all underneath commands will not see either your build.prop hostname or the android_id hostname! So you need to set that too.

hostname HOSTNAMEHERE or echo HOSTNAMEHERE > /proc/sys/kernel/hostname

The dhcpcd command, which is run to get a dhcp address, will not update to a hostname provided by the server (That can be fixed by adding the right dhcpcd-run-hooks and dhcpcd.conf), and it will not provide a hostname to the dhcp server if $(hostname) is blank or localhost, and it does not internally use net.hostname. libnetutils is used for calling dhcpcd with -h "net.hostname", but if for some reason it decides not to call with -h, DHCPCD WILL STILL SEND THE SYSTEM HOSTNAME via gethostname(), as long as it's not "(none)","localhost", or empty. On Stock Froyo anyway. Samsung screwed the pooch on some devices like mine. No hostname pass through, forced network time, etc.

The last thing you can do is edit /etc/dhcpcd/dhcpcd.conf. If you add hostname YOURHOSTNAME to the file, it will use that, unless a hostname is given on the commandline. This won't fix the android_234etc issue, but will if the hostname is localhost (My problem, since Samsung screwed libnetutils and localhost in init.rc). You will need Root, but this works across reboots.

share|improve this answer
add comment

Go to Google Play Store. Search for "hostname", and download hostname changer app.

Must be rooted.

share|improve this answer
    
This worked fine for me thanks. –  Pierre de LESPINAY Jul 3 '13 at 10:42
add comment

I found a way to do this on my rooted Nexus 7 with ICS (4.2.2). The setting is saved persistently and works throughout reboots.
Source: http://nileshgr.com/2012/10/13/how-to-change-wifi-host-name-of-your-android-device

  1. Note that the device must be rooted to use adb
  2. Run adb pull /system/build.prop
  3. Edit the build.prop file and append net.hostname=NewHostname
  4. Run adb push build.prop /sdcard/build.prop (or /mnt/sdcard, if it fails)
  5. Run adb shell and execute the following commands:
    $ su
    # mount -o remount,rw /system
    # cp /sdcard/build.prop /system/build.prop (or /mnt/sdcard if you used that previously)
    # mount -o remount,ro /system
    # exit
  6. Reboot the device
share|improve this answer
    
This was fixed in newer versions of Android. It checks net.hostname from build.prop. Older Android versions do not (Mainly Froyo, maybe Gingerbread). –  cde Jan 4 at 12:22
add comment

To change the hostname (device name) you have to use the terminal (as root):

For Eclair (2.1): echo MYNAME > /proc/sys/kernel/hostname

For Froyo (2.2): (works also on most 2.3) setprop net.hostname MYNAME

Then restart your wi-fi. To see the change, type uname -a

some devices needs reboot for work!

share|improve this answer
    
Does this work on jelly bean? –  jrg Sep 1 '12 at 3:43
1  
This works, but does not persist on reboot. –  palswim Aug 8 '13 at 18:16
add comment

I have not ran stock in a long time but in Application Settings > Development you will see the option 'Device hostname'.

share|improve this answer
    
on what versions of Android? When I look at development options on my Droid 3 (Android 2.3.4), I don't have that option. –  Michael Kohne Mar 19 '12 at 15:24
1  
This works on CyanogenMOD and probably other modified ROMs but not stock AOSP ROMs. –  Caleb Oct 18 '13 at 15:50
    
Completely dependent on the manufacturer and builder, as well as android version. –  cde Jan 4 at 12:21
add comment

You need to edit your hosts file, /system/etc/hosts. Edit the HOSTNAME=xxx line

share|improve this answer
    
This is working on nonrooted devices ? –  Cristi Sep 13 '10 at 19:48
    
Any idea doing it without rooting the device first? –  keyboardsurfer Sep 13 '10 at 20:04
    
I see 127.0.0.1 localhost –  sunpech Sep 14 '10 at 0:49
6  
-1: This is for setting up a local alias, not for actually renaming the device. No other devices, such as the router in question, can see or use this name. –  Matthew Read Nov 29 '11 at 17:31
1  
I second Matthew Read; and btw, editing the hosts file require root privileges –  Power-Inside Dec 1 '11 at 13:48
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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