Can anybody tell me how can I set the static IP and gateway programmatically in Android 6?
I have read here and here.
Settings.System is not working anymore
I've dug some into the problem and my findings is that code that used to work for Andrdoi 5.x might work if the application is set to be the device owner.
Solution:
The solution is to add the device as deviceOwner. This will allow for static IP to be set using the 5.x hacks as referenced by Mogi. A good example of how this is done is using the example found here:
https://github.com/googlesamples/android-DeviceOwner/
Using adb shell and running the command:
dpm set-device-owner com.example.android.deviceowner/.DeviceOwnerReceiver
will make it ready to be allowed to do its job.