How to configure IP address of non-WiFi Android device programmatically? Android 5.x

I went over all of this and did not use my own solutions.

Basically, I am connecting to another device via an Ethernet cable (this is kind of a hack, don't worry, I know!). This unit cannot use Wi-Fi, Bluetooth, etc. It MUST be over ethernet.

I can communicate with this device over this ethernet, but this requires changing the IP address.

However, I can only find wifi solutions not working. I am hoping for a solution that is more suitable for configuring the IP address for use on this network.

Does anyone have a suggestion?

NOTE. It is looking for a solution to this programmatically / through code.

EDIT: For clarification, this is an attempt with WiFi . No WiFi Manager as WiFi is disabled for this Android device (as needed). Reflection, of course, is fragile, but it seems inevitable.

I started trying something to use the ConnectivityManager and NetworkInterface, but I can't figure out how to get to the "IP rung setting". This is mainly due to the fact that you cannot find anything that will allow you to set the IP address outside the WifiConfiguration (which, as I mentioned, cannot be used here).

+3


source to share





All Articles