()
| 110 | } |
| 111 | |
| 112 | public static String getIp() { |
| 113 | try { |
| 114 | String ip = getHostAddress("wlan"); |
| 115 | if (!ip.isEmpty()) return ip; |
| 116 | ip = getHostAddress("eth"); |
| 117 | if (!ip.isEmpty()) return ip; |
| 118 | ip = getWifiAddress(); |
| 119 | if (!ip.isEmpty()) return ip; |
| 120 | return getHostAddress(""); |
| 121 | } catch (Exception e) { |
| 122 | return ""; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | private static String getWifiAddress() { |
| 127 | WifiManager manager = (WifiManager) Init.context().getApplicationContext().getSystemService(Context.WIFI_SERVICE); |
no test coverage detected