سؤال

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