Assign static IP to ethernet card from OTG

两盒软妹~` 提交于 2019-12-21 19:43:16

问题


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.

Any ideas?

Thank you


回答1:


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();

And also you can use ifconfig instead of netcfg.



来源:https://stackoverflow.com/questions/23397803/assign-static-ip-to-ethernet-card-from-otg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!