Monday, April 23, 2012 9:28 AMHi
I'm developing an application where , i need to detect country name according to device location
if user from uk download my app from marketplace then.. i need to detect country as UK in codeif someone from usa download my app then, i need to detect country as usa in code
that way i will show different helpline phone no according to country
Thanks in advance
Monday, April 23, 2012 10:29 AMHi,
You may find the following useful :-
Hope this helps.
Monday, April 23, 2012 12:14 PMHi,
you can use bing geocodeservice for retrieving country Region from current location..
1st you need to find the current location then you call the service to find country Region..here I'm writing some code ..
1.For find the current location
GeoCoordinate location = null;
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
if (watcher != null)
watcher = null;
location = e.Position.Location;
ObtainCountry();//by this funtion you obtain country region
2. for call the service and find the country region..
public void ObtainCountry()
if (location == null)
ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();
// Set the credentials using a valid Bing Maps key
reverseGeocodeRequest.Credentials = new BingService.Credentials();
reverseGeocodeRequest.Credentials.ApplicationId = "your bing application id";
// Set the point to use to find a matching address
BingService.Location point = new BingService.Location();
point.Latitude = location.Latitude;
point.Longitude = location.Longitude;
reverseGeocodeRequest.Location = point;
// Make the reverse geocode request
GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(geocodeService_ReverseGeocodeCompleted);
void geocodeService_ReverseGeocodeCompleted(object sender, ReverseGeocodeCompletedEventArgs e)
string countryRegion = e.Result.Results.Address.CountryRegion;
Monday, April 23, 2012 2:59 PMI don't believe that you can read which marketplace an application was installed from.The System.Globalization.CultureInfo.CurrentUICulture.* and System.Globalization.CulutreInfo.CurrentCulture.* methods are available, but you can hit cases like me where I have my culture set to different settings at different times.
You can use LocationServices to try and figure out which country a person is in.
You can look at the mobile provider information to try and determine where the user is from.
Any of the first three methods you can use to set a default user setting for their help number, but it might be useful to allow the to set their location somewhere in the application as there are no guarantees that it would be the number they are looking for.