Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to get the current country code, you want to look into <a href="http://developer.android.com/reference/android/location/Geocoder.html" rel="nofollow noreferrer"><code>Geocoder</code></a> which you can use to get an <a href="http://developer.android.com/reference/android/location/Address.html" rel="nofollow noreferrer"><code>Address</code></a> which provides a <a href="http://developer.android.com/reference/android/location/Address.html#getCountryCode%28%29" rel="nofollow noreferrer"><code>getCountryCode</code></a> method. Something like this</p> <pre><code>Geocoder geocoder = new Geocoder(this); List&lt;Address&gt; addresses = null; try { addresses = geocoder.getFromLocation( location.getLatitude(), location.getLongitude(), 1); } catch (IOException e) { e.printStackTrace(); } if (addresses != null &amp;&amp; addresses.size() &gt; 0) { Address address = addresses.get(0); String countryCode = address.getCountryCode(); } </code></pre> <p>As far as getting the current latitude and longitude, there is plenty of information out there on how to do that</p> <ul> <li><a href="https://stackoverflow.com/questions/1513485/how-do-i-get-the-current-gps-location-programmatically-in-android">How do I get the current GPS location programmatically in Android?</a></li> <li><a href="https://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-in-a">What is the simplest and most robust way to get the user&#39;s current location on Android?</a></li> <li><a href="http://developer.android.com/guide/topics/location/index.html" rel="nofollow noreferrer">http://developer.android.com/guide/topics/location/index.html</a></li> </ul>
 

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