Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

How to change hostname

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to change hostname

    Hi everyone,

    Recently I looked at how the device was showing under router system (wifi or wired)
    It show as android-123456789

    I found a way to change this via setprop net.hostname whateveryouwant
    You can check that it has changed via getprop net.hostname or even checking your router's connected device list..

    But

    Some apps that uses this hostname still show as the old one (original one)

    Is there a way to change this?
    Any thoughts?

    Thanks in advance!

    #2
    Man... learn something new every day!

    I have never even looked at this or noticed it before..... Interesting find.

    Now since I have not looked at this I am going to speculate. On first boot up of a ROM, understand there is nothing in /data. This is initially built by the kernel, etc on first boot. So many thing could read build.prop and take those settings and commit them to /data/data/ folder or even Dalvik cache! Once there they may never look again. This would especially be true for APPs that get installed after boot and use that info.

    My suggestion as painful as it might be, would be to leave your changes to build.prop and then do a factory reset which erases /data and makes it start over again..

    If you do try this, PLEASE let me and everyone else know if that solves this.

    Bob
    "Pzebacz im, bo nie wiedzą, co czynią"
    "Прости им, они не ведают, что творят"
    "Perdona loro perché non sanno quello che fanno"
    "Vergib ihnen, denn sie wissen nicht, was sie tun"
    "Vergeef hen want ze weten niet wat ze doen"
    "Pardonne-leur car ils ne savent pas ce qu'ils font"
    "Perdónalos porque no saben que lo que hacen"
    "Oprosti im, jer ne znaju što čine"
    "Forgive them as they know not what they do"





    Comment


      #3
      Thanks bob for sharing your thoughts!
      After you mentioned /data/data/ I had a good look and I see settings.db under the folder com.android.providers.settings/databases/
      If I open it I can see there my android_ID

      What will be the best approach/tool to modify this ID?

      Thanks

      Regards
      Alex

      Comment


        #4
        It seems the file is already open and probably in use by the device so cant save it after modification

        Tried USB PC connection but of course cant access root files

        Is there a way to access the device while no files are accessing it like in command mode?
        I believe the file is in use by the device but it must be possible to remove this linkage?
        When flashing a rom to the device, maybe having an option to change this?

        Or maybe a new rom that allows to modify the hostname directly onto the settings.db file?

        Ideally, it should be possible to modify the settings.db even after a rom is installed, so no need to reimage or reinstall

        Anyone knows an app that allow to modify file even in use by the device

        Any thoughts please?

        Comment


          #5
          Right, here are some more info

          I installed Android SDK but these devices, MK808 and I guess other Android stick devices, in order to be pick up via windows, needs the drivers to be installed and for that the drivers can be installed only if they are recognised as a device.
          So when you plug the usb into the laptop/pc end and the device end to OTG, you need to have the device OFF and have the small button (next to the power LED) pressed (with a paperclip size pin)

          Even if the driver is installed, the only way it is recognised is when the device is off, hence not been powered on!

          ADB needs the device to be powered on and USB debugging set on..

          So I was not able to use ADB to play around with the settings.db file
          It would have been nice if it worked, then it would have been a simple modify of this via a copied file then copied over back to the right place on the root.. (which also mean setting the device to USB PC connection and this can only be done when the device is powered on..)

          Does anyone have any other ideas, I am about to give up

          Thanks in advance!!
          Alex

          Comment


            #6
            oh btw, I did previously change the build.prop with a new line right at the bottom that read
            net.hostname = whatevername

            But this caused the device not to boot anymore, or boot but freezes in the boot process..
            Be aware

            Comment


              #7
              I think the only way to really fix this is to probably take apart framwork.jar andf find in one of the ,smali files where they are setting the host name and change the code.

              If you get Sqlite3 APP you can edit settings.db but I do not know if it will stay persistant on a reboot.

              Bob
              "Pzebacz im, bo nie wiedzą, co czynią"
              "Прости им, они не ведают, что творят"
              "Perdona loro perché non sanno quello che fanno"
              "Vergib ihnen, denn sie wissen nicht, was sie tun"
              "Vergeef hen want ze weten niet wat ze doen"
              "Pardonne-leur car ils ne savent pas ce qu'ils font"
              "Perdónalos porque no saben que lo que hacen"
              "Oprosti im, jer ne znaju što čine"
              "Forgive them as they know not what they do"





              Comment


                #8
                I did it lol

                Took some time but its working

                first I made the changes via setprop net.hostname whatevername then used root to access settings.db, made a copy of it, then modified this one with the new hostname, then again using root I copied over the existing settings.db and finally rebooted the device
                There is a bit more to it that my explanation but thats the logic behind it..

                Et voila!

                Hope this helps others

                Regards
                Alex

                Comment

                Working...
                X