Android get IP-Address of a hotspot providing device

前端 未结 6 1364
半阙折子戏
半阙折子戏 2020-12-05 05:27

I\'m currently using

public static String getLocalIPAddress(WifiManager wm){
    return Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());
}
         


        
6条回答
  •  清歌不尽
    2020-12-05 05:56

    open termux and run

    ip -4 route get 8.8.8.8 | grep via
    

    You'll something like this:

    8.8.8.8 via 192.168.43.248 dev wlan0 table 1030 src 192.168.43.20 uid 12345
    

提交回复
热议问题