title: Detecting "use only 2G networks" setting
body: <p>Is there a way of returning the value of Android's mobile network setting for "use only 2G networks"?</p>
  
  <p>The app being developed measures the internet speed at a certain location, but in order for this to be relevant, it must know if the user is deliberately restricting mobile internet to 2G.</p>
  
  <p>I've taken a look at ConnectivityManager, but it only provides information about the background data setting or all networks. Iterating through them reveals that despite the setting being enabled, HSPA and UMTS return <code>true</code> for <code>isAvailable()</code>:</p>
  
  <pre><code>for (NetworkInfo netInfo : cm.getAllNetworkInfo()) {
      Log.i(TAG, netInfo.getSubtypeName() + ": " + netInfo.isAvailable());
  }
  </code></pre>
  
  <p>The only hint I've found amidst all this is that <code>netInfo.getReason()</code> returns "connectionDisabled" on HSPA and UMTS when the setting is enabled. The trouble is, when the setting is disabled, those network types don't necessarily appear in the list at all. It doesn't seem right to me to use a string comparison specifically on HSPA and UMTS for "connectionDisabled".</p>
  
  <p>What's the right way of tackling this?</p>