Set static IP and gateway programmatically in Android 6.x (Marshmallow)
问题 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 and goolgle says WIFI_STATIC_IP was deprecated in API level 17 and Use WifiManger instead. Unfortunately I cannot find anything about it in WifiManger and WifiConfiguration classes. 回答1: Since there's no official API I have to come up with a solution by modifying samples from the following code snipet and this answer. This solution works