5

Is there a way to detect the current country of a mobile device? What I want for my application is that on sign up page, I require my user to enter the country code and the mobile number. I want the country code to be filled up based on the current country the user is in by default on my picker control.

4

2 Answers 2

4

What about RegionInfo.CurrentRegion?
No platform code needed!
Source

4
  • On iOS, this will return the device's language instead of the actual region.
    – mr5
    Oct 4, 2019 at 7:50
  • this doesnt get the country phonenumber code
    – Dan
    Jun 17, 2021 at 22:44
  • This ive wrong info! I am in Australia yet it shows UK! Sep 10, 2021 at 1:01
  • You can check the RegionInfo class for different formats, and of course, this relays on the device settings. learn.microsoft.com/it-it/dotnet/api/… Sep 23, 2021 at 15:37
-1

for Xamarin Android : Java.Util.Locale.Default.ToString() for Xamarin IOS : NSLocale.PreferredLanguages[1]

1
  • This gives wrong value. For example I am in Australia, it shows en-GB (Great Britain)! Sep 10, 2021 at 1:12

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.