How do I find the DNS servers in Android from a Java program?

前端 未结 4 1187
梦谈多话
梦谈多话 2021-02-19 00:41

The java.net.InetAddress.GetByName(String host) method can only return A records so to lookup other record types I need to be able to send DNS queries

4条回答
  •  囚心锁ツ
    2021-02-19 01:21

    I don't think it's possible for general case. For WiFi I found this:

    WiFiManager wifi = (WifiManager) getSystemService(WIFI_SERVICE); 
    DhcpInfo info = wifi.getDhcpInfo(); 
    

提交回复
热议问题