title: Getting Android WiFi-only device country when there's no internet connection & no GPS
body: <p>I'm trying to determine the country in which the user/device is located as I need to determine if they are within the EU.</p>
  
  <p>I know I can use this:</p>
  
  <pre><code>TelephonyManager tm = (TelephonyManager)getSystemService(getApplicationContext().TELEPHONY_SERVICE);
  String countryCode = tm.getNetworkCountryIso();
  </code></pre>
  
  <p>And then simply check the countryCode string against the 28 EU Member states.</p>
  
  <p>However, this is only useful on phones (and generally speaking <em>not</em> where those phones are <a href="http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkCountryIso()" rel="nofollow">CDMA</a> (as this is, apparently, unreliable).</p>
  
  <p>I know with a wifi-only device that currently has a live connection, I can fire off a request <a href="http://ip-api.com/json" rel="nofollow">here</a>, (or other such sites), to get a country code back, however, this isn't an option when a wifi-only device is offline (WiFi switched off).</p>
  
  <p>I <strong>do not</strong> want to add extra permissions to my app, so using GPS is out of the question, are there any other (at least more than slightly reliable) ways I can obtain the country code of a device (using local settings perhaps or something similar).</p>
  
  <p>The reason is that I need to show a dialog <strong>only to EU Users</strong> and if they fire up the app without being online (unlikely, but possible), the app will need to know this info.</p>
  
  <p>I've read many questions on this subject, however, all of those questions are open to suggestions about how to obtain this info <em>with a live internet connection or telephony device</em>, they are not specifically regarding off-line devices and it is still unclear to me how I can go about getting this info.</p>