title: Android force traffic over internet while WiFi enabled
body: <p>I'm starting to write an Android application to perform background monitoring of my web server. With WiFi enabled a problem will be that traffic is directed over that by default, I'd like to always use 3G for the HTTP request to check external availability as well. I know I could use this code to disable WiFi programmatically:</p>
  
  <pre><code>WifiManager wifiManager = (WifiManager)getBaseContext().getSystemService(Context.WIFI_SERVICE);
  wifiManager.setWifiEnabled(false);
  </code></pre>
  
  <p>But as it will be running in the background it's a bit clumsy and will interrupt other operations over WiFi while the check is in progress. Looking at the <a href="http://developer.android.com/reference/java/net/Socket.html" rel="nofollow">Socket Documentation</a> I can't see any apparent way to achieve this. I'm wondering if there's any supported way to achieve this on a non-rooted phone? I have full control over the server so the protocol doesn't specifically have to be HTTP.</p>