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.)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 writeRuntime.exec()in the android’s environment — Runtime.exec() : Reboot in Android?