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

前端 未结 4 1194
梦谈多话
梦谈多话 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:12

    To get system properties of an android system, static methods in this class (android.os.SystemProperties) can be used. As it is not an open api, you can't compile it against the sdk. Work around is needed to do that, e.g. copy the code from AOSP to get thru the compilation. As this class is for internal use, do this at your own risk. Have fun.

提交回复
热议问题