0

I am creating an application which shows some data on the basis of user country. Currently, I am asking the user to select the country and then storing it. Is there any way, so that the application can get the user local setting from the device and automatically select the corresponding country for the user?

Thanks Ashwani

Ashwani K
  • 7,880
  • 19
  • 63
  • 102

1 Answers1

3

Using Locale.getDefault() should be sufficient for determining the user's preferred locale. I would need more information on the nature of your data to determine whether it would be proper to use their preferred locale to determine their country, or whether you should be using the GPS/TelephonyManager to get this info.

See here for more info regarding Locale.

See this similar question for more solutions using TelephonyManager.

Community
  • 1
  • 1
Ben Siver
  • 2,758
  • 1
  • 25
  • 42