在成功的3G或LTE数据呼叫之后,我需要获取运营商分配的IPaddress。
$adb shell netcfg >> doesnt have the assigned IP address.
我尝试了adb shell dumpsys
和grep ip地址,但没有成功。有什么帮助/指示吗?
发布于 2015-09-17 11:50:47
您可以通过这种方式获得设备ip地址:
adb shell ip route > addrs.txt
#Case 1:Nexus 7
#192.168.88.0/23 dev wlan0 proto kernel scope link src 192.168.89.48
#Case 2: Smartsian T1,Huawei C8813
#default via 192.168.88.1 dev eth0 metric 30
#8.8.8.8 via 192.168.88.1 dev eth0 metric 30
#114.114.114.114 via 192.168.88.1 dev eth0 metric 30
#192.168.88.0/23 dev eth0 proto kernel scope link src 192.168.89.152 metric 30
#192.168.88.1 dev eth0 scope link metric 30
ip_addrs=$(awk {'if( NF >=9){print $9;}'} addrs.txt)
echo "the device ip address is $ip_addrs"
https://stackoverflow.com/questions/13169249
复制相似问题