Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: How to set a static IP for new WiFi configuration
    primarykey
    data
    text
    <p>Again stuck on the same problem.</p> <p>I have found around that we can set static system settings like this:</p> <pre><code>System.putString(getContentResolver(), android.provider.Settings.System.WIFI_USE_STATIC_IP, "1"); // to define it use static ip's System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_IP,"192.168.1.15"); System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_NETMASK,"255.255.255.0"); System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_DNS1,"192.168.1.1"); System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_GATEWAY,"192.168.1.1"); </code></pre> <p>But <strong>No Success!</strong></p> <p>I don't understand that when to set these settings?</p> <p>Should I do it before the wifi configuration creation or after saving the wifi configuration or even before activating it or after it?</p> <p>However, I have tried the all possible cases from my side and when I check Android WiFi settings, I see it's still on DHCP.</p> <p>A previous question i.e. <a href="https://stackoverflow.com/questions/10278461/how-to-configue-static-ip-netmask-gateway-programmatically-on-android-3-x-or-4">How to configue a static IP address, netmask, gateway programmatically on Android 3.x or 4.x</a> has completely ruined my android device and now it can't switch ON its WiFi anymore.</p> <p>I also tried static IP on my HTC phone and no success, its always in DHCP mode!</p> <p>Do I need to call a "<strong>reconnect</strong>" command? If yes, then in which way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload