如何通过code获得电脑的IP地址,在Android模拟器模拟器、地址、电脑、code

2023-09-06 17:01:09 作者:临风不自傲

我使用这个链接如何获得设备的IP地址?但得到的IP地址而不是从我的机器不同的....我怎样才能在Android模拟器我的机器的IP地址。

i am using the code of this link How to get ip address of the device? but getting ip address different than from my machine....how can i get the ip address of my machine on android emulator..

在此先感谢

推荐答案

的检查了这一点的,如果你要访问的主机。

Check this out if you want to access host machine.

另一种方法是在shell中运行这个

Another solution is to run this on shell

$亚行外壳日凌晨开始-a android.intent.action.WEB_SEARCH -e查询什么是我的IP

$ adb shell am start -a android.intent.action.WEB_SEARCH -e query "what is my ip"

它会显示你的系统IP

it will display your system IP