hxb
2021-12-08 39203340a182118df68c9c8b0edad5edf5c72f15
HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/utils/IpUtils.java
@@ -37,6 +37,23 @@
        return "255.255.255.255";
    }
    public static boolean isLocalIpAddress(String ipAddress) {
        try {
            for (Enumeration<NetworkInterface> niEnum = NetworkInterface.getNetworkInterfaces();
                 niEnum.hasMoreElements(); ) {
                NetworkInterface ni = niEnum.nextElement();
                for (InterfaceAddress interfaceAddress : ni.getInterfaceAddresses()) {
                    if (ipAddress.equals(interfaceAddress.getAddress().getHostAddress())) {
                        return true;
                    }
                }
            }
        } catch (SocketException e) {
            e.printStackTrace();
        }
        return false;
    }
    public static String getIP(Context application) {
        WifiManager wifiManager = (WifiManager) application.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        if (!wifiManager.isWifiEnabled()) {