I have the screenshot
and I am intending to retrieve the country which
Try this
System.Globalization.RegionInfo.CurrentRegion.DisplayName;
Use System.Threading.Thread.CurrentThread.CurrentCulture.
It should correctly reflect the phone language.
I know it's old, but maybe someone comes here looking for answer:
System.Globalization.RegionInfo.CurrentRegion.TwoLetterISORegionName
This is what i did at the end of the day. First I used the Location API library to get the coordinates(longitude and latitude) of the location
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
try
{
// Request the current position
Geoposition geoposition = await geolocator.GetGeopositionAsync(
maximumAge: TimeSpan.FromMinutes(5),
timeout: TimeSpan.FromSeconds(10)
);
string latitude = geoposition.Coordinate.Latitude.ToString("0.00");
string longitude = geoposition.Coordinate.Longitude.ToString("0.00");
}
catch (Exception ex)
{
if ((uint)ex.HResult == 0x80004004)
{
// the application does not have the right capability or the location master switch is off
MessageBox.Show("Location is disabled in phone settings.", "Can't Detect Location", MessageBoxButton.OK);
}
//else
{
// something else happened acquring the location
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
then using google's reverse geolocation to get the information or details of the location based on the longitude and latitude
http://maps.googleapis.com/maps/api/geocode/json?latlng=latitiude,longitude&sensor=true
i.e if the latitude is 60 and the longitude is 60
http://maps.googleapis.com/maps/api/geocode/json?latlng=60,60&sensor=true
From the json result, you will be able to retrieve the country's long and short name.
The correct answer to what the user is asking is this:
Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion
This should give you information regarding the Country/Region selection in the language+region setting.