Reputation: 663
My app use phone number as user ID, It will be good to detect the home PLMN of the SIM card and convert it to the country code(like +1, +33, etc.), then you don't have input the digits. I guess it could be done with RIL in windows mobile, but in a windows phone 7 it seems there is no such kind of APIs. Another choice is to get the CultureInfo, but some times the CultureInfo may not match with the SIM you are using, for example you take your phone abroad, usually you keep the phone region settings as your home land but you may use a local SIM card.
Upvotes: 2
Views: 684
Reputation: 317
There does not appear to be any API action that allows you to look at the specific cultures embedded into a SIM for WP7. However, if you the general culture option is still appropriate you could do something like this:
string countryCode = CultureInfo.CurrentCulture.Name;
try {
RegionInfo reg = new RegionInfo(countryCode);
string name = reg.Name;
string displayname = reg.DisplayName;
string ISORegion = reg.TwoLetterISORegionName;
string currency = reg.CurrencySymbol;
string eng = reg.EnglishName;
string native = reg.NativeName;
}
catch (ArgumentException argEx) {
// The country code was not valid
}
If your application needs to be based on the current location please consider using the GPS task. Details for getting GPS data can be reviewed here.
Also converting the GPS data to a specifc country can be completed by geocode reversing as shown here.
Upvotes: 3