How to get current system DNS resolvers ip-addresses in codename one?

≯℡__Kan透↙ 提交于 2020-02-02 10:08:07

问题


Is there a way to get all current system DNS resolver ip-addresses in codename one?

The classes NetworkManager and ConnectionRequest don't provide these information.

In general Codename One seems not to provide any way to access a devices communication status information like "Wi-Fi Mac address", "IMEI", "Mobile network type" etc. Am I right?


回答1:


Do you mean something like Socket.getHostOrIP()?

There is no standardized explicit DNS lookup API though.

Most of these things aren't available across platform or even consistently within the platform. You can use Display's getProperty with "IMEI", "UDID" & "MSISDN". But that will only have any chance of working on Android and you will probably need to add the build hint for permissions.

You can also always use native code calls as explained in the developer guide and the How Do I? video.

I would suggest that you revisit your need to get these values and evaluate a way around them. E.g most advertisers no longer require them as they aren't provided by all mobile OS's.



来源:https://stackoverflow.com/questions/37040610/how-to-get-current-system-dns-resolvers-ip-addresses-in-codename-one

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!