从OTG将静态IP分配给以太网卡 [英] Assign static IP to ethernet card from OTG
本文介绍了从OTG将静态IP分配给以太网卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为通过OTG电缆连接到Android设备的以太网卡分配静态IP.应该以编程方式完成,但是在android中找不到有关以太网卡的参考.
I would like to assign a static IP to an ethernet card, connected to the Android device via OTG cable. It should be done programmatically, but I can't find any reference regarding ethernet cards in android.
有什么想法吗?
谢谢
推荐答案
如果它是根设备,则可以尝试使用此
If its a rooted device you can try with this
Process process = Runtime.getRuntime().exec(new String[] { "su", "-c", "netcfg eth0 192.168.0.123"});
process.waitFor();
而且您也可以使用 ifconfig
代替 netcfg
.
And also you can use ifconfig
instead of netcfg
.
这篇关于从OTG将静态IP分配给以太网卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文