문제

I am trying to figure out what is the fastest way the figure out the current user Country. I know there are a lot of location examples online, my actual is question: since I don't care much about precision, is it OK if I use RegionInfo.CurrentRegion.DisplayName; to figure out the user country?

What are the downsides of using this approach (besides precision)?

도움이 되었습니까?

해결책

No, you shouldn't use RegionInfo.CurrentRegion for that.

For example, I live in Montenegro, but RegionInfo.CurrentRegion on my phone will return USA, which is completely irrelevant being almost 4000 miles away from here.

You have to use Geolocator class for that. Here's some sample code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top