title: Getting WiFi proxy settings in Android
body: <p>I am trying to read WIFI proxy settings</p>
  
  <ul>
  <li>Proxy host</li>
  <li>Proxy port</li>
  <li>Proxy user (authentication)</li>
  <li>Proxy password (authentication)</li>
  </ul>
  
  <p>from devices in android versions 2.X.X – 4.X.X without any success.</p>
  
  <p>Calling: </p>
  
  <pre><code>String proxy = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.HTTP_PROXY);
  </code></pre>
  
  <p>Always returns null.</p>
  
  <p>I've also added to my android manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /&gt;
  </code></pre>
  
  <p>still it returns null.</p>
  
  <p>Also tried:</p>
  
  <pre><code>android.net.Proxy. getHost(Context ctx) – which is deprecated – returns the IP
  android.net.Proxy. getPortt(Context ctx) – which is deprecated – returns always -1.
  </code></pre>
  
  <p>Java calls:</p>
  
  <pre><code>System.getProperty("http.proxyHost");
  System.getProperty("http.proxyCall");
  </code></pre>
  
  <p>Also returns null.</p>
  
  <p>Is there a working code which retrieves all these settings or at least partially from devices in all android versions?</p>