Android Question Change ethernet settings

Blueforcer

Well-Known Member
Licensed User
Longtime User
We have 7" android HMI panels with ethernet.

I need to extend our app in order to change the network settings. Like set to StaticIP, DHCP and Ip adresses.
Since we have root access im able to change these settings with´adb
e.g
B4X:
su
ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
route add default gw 192.168.1.1 dev eth0
setprop net.dns1 8.8.8.8
setprop net.dns2 8.8.4.4

This works perfectly.

but now i need to do it with my app. Since the app is signed with the system key it also have root access.
Im using the suShell lib from https://www.b4x.com/android/forum/threads/superuser-acquiring-root-permissions-the-easy-way.43322/

B4X:
    su.ExecuteWithEvent($"ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up"$, "su").WaitForCompletion
    su.ExecuteWithEvent($"route add default gw 192.168.1.1 dev eth0"$, "su").WaitForCompletion

unfortunally this doesnt change anything here. I also get no error as return string i get the same response as with adb.
Any idea here?
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…