Reputation: 12348
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.)
Upvotes: 0
Views: 1716
Reputation: 4431
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?
Upvotes: 1