简体   繁体   中英

Xamarin Forms - How to get the current country of the device

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM