@@ -39,45 +39,10 @@ object NetworkUtils {
3939 Logger .e(TAG , " Error getting available IPs" , ex)
4040 }
4141
42- // Add hotspot IP as default if not already present
43- val hotspotIp = getHotspotIpAddress()
44- if (! ips.contains(hotspotIp)) {
45- ips.add(0 , hotspotIp)
46- }
47-
4842 Logger .d(TAG , " Available IPs: $ips " )
4943 return ips
5044 }
5145
52- /* *
53- * Get the IP address of the device's WiFi hotspot
54- */
55- fun getHotspotIpAddress (): String {
56- try {
57- val interfaces = Collections .list(NetworkInterface .getNetworkInterfaces())
58- for (intf in interfaces) {
59- if (! intf.name.contains(" wlan" , ignoreCase = true ) &&
60- ! intf.name.contains(" ap" , ignoreCase = true )) continue
61-
62- val addresses = Collections .list(intf.inetAddresses)
63- for (addr in addresses) {
64- if (addr is Inet4Address && ! addr.isLoopbackAddress) {
65- val ip = addr.hostAddress ? : continue
66- // Hotspot IPs typically start with 192.168.x.x
67- if (ip.startsWith(" 192.168." )) {
68- Logger .d(TAG , " Found hotspot IP: $ip " )
69- return ip
70- }
71- }
72- }
73- }
74- } catch (ex: Exception ) {
75- Logger .e(TAG , " Error getting hotspot IP address" , ex)
76- }
77- Logger .d(TAG , " Using default hotspot IP: 192.168.43.1" )
78- return " 192.168.43.1" // Default fallback
79- }
80-
8146 /* *
8247 * Check if the device is connected to a VPN
8348 */
0 commit comments