0

Does anyone know the code to change an android phone's eth0 IP address (InetAddress)?

(I know that from the command line I can do ifconfig eth0 new_ip_addr. But I'm asking about something that I can put into the source code.)

1 Answer 1

1

There's a class called NetworkInterface but it lets you to retrieve the iface's data. I would recommend using Runtime.exec("ifconfig".... NetworkInterface -> getDisplayName() and so on ) Here is some insight on how to write Runtime.exec() in the android's environment -- Runtime.exec() : Reboot in Android?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.