如何通过code获得电脑的IP地址,在Android模拟器 [英] how to get ip address of pc in android emulator through code

查看:177
本文介绍了如何通过code获得电脑的IP地址,在Android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个链接如何获得设备的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

这篇关于如何通过code获得电脑的IP地址,在Android模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆