Is there way to clear the dns cache of android device pogrammatically??.I search lot on google but didnt find anything regarding this.
As root, do in a shell:
ndc resolver flushdefaultif
And if you want to do it programatically, try this piece of code:
public boolean reboot() {
Process proc = null;
try {
proc = Runtime.getRuntime().exec("su");
proc.getOutputStream().write(("ndc resolver flushdefaultif").getBytes());
return proc.waitFor() == 0;
} catch (IOException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With