7

Is there a way to programmatically find out what country a user's phone is from when my app is opened on their phone?

I have an app I'm developing that can use lbs/kg units and if someone's phone is from the United States, I want to enable lbs by default and if the phone is from anywhere else, I want to display kg by default. (note that I don't need think checking where they are connecting from would be accurate because it could be that they are travelling or using another country's proxy server).

Stan
  • 746
  • 1
  • 17
  • 35

4 Answers4

7

You can't get the country, but you should be able to guess it from:

Personally, I wouldn't worry about the travelling scenario - travelling Americans purchasing your app represents a very small percentage of your downloads.

Community
  • 1
  • 1
Stuart
  • 66,722
  • 7
  • 114
  • 165
  • too bad this is not exactly exposed as a home country field, but looks like Locale will suffice. thx! – Stan Mar 11 '11 at 01:54
2

You could also use the GPS to get their current position, then use the Bing API to get the country from the lat/long.

Using the GPS involves it's own headaches like adding a Privacy Policy, but from Stuart's answer, it seems like the most accurate way.

Martin
  • 11,031
  • 8
  • 50
  • 77
1

System.Globalization.RegionInfo.CurrentRegion.DisplayName;

Brains
  • 594
  • 1
  • 6
  • 18
0

Why not just look at System.Globalization.RegionInfo.CurrentRegion.IsMetric?

There is an example here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.globalization.regioninfo.ismetric(v=vs.105).aspx

noggin182
  • 627
  • 4
  • 14