| | |
| | | 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()) {
|