AlGoreRhythm AlGoreRhythm - 22 days ago 5
C# Question

Am I understanding Region Info correctly?

So I don't necessarily need geocoding permissions, I don't care what the users city or location is, I just want to get the users country, or even continent. I found this guy in Xamarin documentation

System.Globalization.RegionInfo


Which when I test and access
System.Globalization.RegionInfo.CurrentRegion.Name
I get back
US
. Which I am in the United States, so that works. But I am beginning to question whether or not this is doing what I think it is. Is
RegionInfo
something I can access to get a users location? The reason I am questioning this is, when I ran my app on iOS simulator on Mac (windows (Xamarin iOS Windows Simulator, not Windows OS) doesn't let you do a custom location for some reason), I had changed the lat/long values to be in Australia. But my value was still
US
. I can chalk that up to being a simulator, perhaps that
RegionInfo
uses some other process and doesn't get affected by the custom lat/long values on simulator. I just want to make sure this is doing what I think it is.

Answer

RegionInfo is a user configurable value - look in Settings -> General -> Language and Region.

If you want to know the user's physical location, you can

1. use GPS
2. ask them
3. try IP geolocation