0

I have an Android tablet with a USB to ethernet adapter. The network interface is configured and the default gateway works and allow internet access.

To fix an issue we are having I would like to change the default gateway to something that is incorrect which will cause the tablet to not be able to access the internet.

Then in our Xamarin application I would like to route the internet traffic through the USB to ethernet NIC like normal but I want to programmatically specify the correct gateway somehow without changing the gateway on the NIC. I can also remove the gateway altogether if that would do the same thing and block traffic. But in that case do I have to do anything special in the traffic to send the traffic to the 192.168.1.1 gateway?

Is this technically possible at all in Xamarin or Java/Android? I am also open to somehow configuring Android itself so that only our application has a valid routing table but I am not sure how to do that.

Thanks ahead of time!

I have not tried anything yet to fix this I'm just brainstorming issues.

HelloWorld
  • 41
  • 4

1 Answers1

0

The document is about WiFiManager. There is a method. But this method was deprecated in API level 29.

At present, the successful changes are all in Android 6.0 and earlier. Here are two links you can refer to them:

How to configure a static IP address, netmask, gateway programmatically on Android 3.x or 4.x

Set static IP and gateway programmatically in Android 6.x (Marshmallow).