Hey defim, thanks for the answer, after ~ 20 or more hard restarts I was now able to feel the "magic". I searched a manual way to flush the dns cache like under windows
but seems Android doesn't provide such "easy" method. We only can use
settings -> applications -> Network Location -> Clear data
but that's not really easy and annoying doing this every time. After some more reseach I found a better solution over here
. It's called NetworkManagementService.flushDefaultDnsCache() method which should work on most android devices. Via terminal it worked quite good but after a restart I need to do all again, which was also pretty annoying, so I added now
values to my build.prop
and it did the job. Someone said over here
it was fixed since JB but seems for me it was not fixed at all (see also here
). Now I was able to cache the entries every 600 seconds (10 minutes). And after some more reboots and more flushes the /system/etc/hosts entries worked for me, I checked against terminal with simply ping command e.g. ping www. mom-nude.com
gave me such as unknown host or something like that.
The only bigger problem I face now is that Windows <-> Android ignores the hosts if I'm using tethering over rmnet1 (IPv6 disabled on Android and Windows) [but still need to add the ::1 localhost
under Windows to see the names]. If I'm using the same hosts file from Android, Windows is not abe to get a connection (no ping works and no internet connection, but icon seems all is fine). So, if I'm gonna to use not such big hosts it works, but it not recognize the entries from Android, strange problem what?
Maybe you can integrate
ndc resolver flushdefaultif
ndc resolver flushif wlan0
somehow in the app (params needs root (and fly mode enabled) but we still have root since XPosed Installer needs root). Or add this into the topic, if someone facing the same problem like me, as written it should be fixed since JB but not all have this fix included.
Maybe you know more to fix my last problem Windows <-> Android tethering, it must be possible to only use one hosts file that get re-applied after dns flush and connectivity change. I would pay for that.