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. 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 on devices from Lollipop upwards. @SuppressWarnings("unchecked") public static void