Where are IP addresses stored on and Android device? In what location on disk, or otherwise; how are they stored?
-
3IP addresses of what?– dantisJul 17, 2014 at 13:46
-
3What's the actual problem you're trying to solve?– Dan HulmeJul 17, 2014 at 13:54
-
I want to store a persistent static IP address for my ethernet interface, to survive during reboot.– JohnyTexJul 17, 2014 at 14:05
-
And what speaks against using the configuration menu? Doesn't that work, or doesn't it survice a reboot?– Izzy ♦Jul 17, 2014 at 14:20
-
There is no static ip configuration choice in my prefs.– JohnyTexJul 17, 2014 at 14:22
2 Answers
Under Settings, Wi-Fi, , Modify Network, Advanced Options, IP Settings, you should have a choice of Static or DHCP. Choosing Static adds input boxes for IP address, Gateway, Network prefix, and DNS.
If you don't have this, I suggest trying a third-party app such as WiFi Manager.
Finally, if you're really talking about where in the filesystem this is stored, it's in /data/misc/wifi/ipconfig.txt
, and is managed by the WifiConfigStore
class. This is not a public API and is only used from class WifiStateMachine
. However, you can find out the format of this file by viewing the source: WifiConfigStore.java.
-
Good effort. However this seems device- or version-dependent because there is no files in my such directory.– JohnyTexNov 1, 2016 at 9:39
-
Your original question doesn't include what version you're interested in, but if it did, I'd be happy to look into the specifics. However, 2+ years after my answer, the latest Android Nougat on my device still has the above file (and others) in
/data/misc/wifi/
. Note that if you don't have root access on your device, you cannot see, list, or access in any way, the files in/data
and below, neither via shell nor file explorer apps. To an unprivileged shell or app, it will appear as though those folders and files don't exist, while in fact they do. Nov 1, 2016 at 16:02 -
I am on Android 4.4.4 . I have root so I was able to expore the location, but couldn't find anything (text-readable, maybe binary?) there.– JohnyTexNov 1, 2016 at 16:25
-
Hmm. I have a disadvantage of no longer having a physical 4.4.4 device to experiment with. I have only a Genymotion 4.4.4 VM which won't help since VMs are never connected to "real" WiFi, only virtual nets. They still have
/data/misc/wifi
but there's no config there except forwpa_supplicant.conf
andsoftap.conf
. This is expected, since the n/w config is "wired." In all the physical devices I currently have (5.1 and 7.0), the above directory containsipconfig.txt
,networkHistory.txt
, and a bunch of other things. Nov 1, 2016 at 18:32 -
1The fact that you have an empty
/data/misc/wifi
leads me to believe that the vendor of your device may have customized this aspect of the device in some way. Having now looked back at the comment discussion on the original question, I suspect this is the case, since you stated you don't have the same menu items as everyone else seems to. Note that the devices I'm working with are all stock Android. Nov 1, 2016 at 18:33
I have found the answer myself. At least for the device I am using here. All settings are stored in an Sqlite database as a file on the filesystem. Check out this thread on how to manipulate that database: