简体   繁体   中英

How accurate is the user locale on Android?

I want to detect certain local/culture related properties for the users of our App, mainly to display/hide certain payment methods and to preselect currencies.

How accurate are the country and currencies that Locale.getDefault() returns on Android?

What sources of information flow into that, are things like the SIM carrier involved?

As far as I know, the Locale.getDefault() depends on the language you select in Settings->Language & Input->Language Setting only. If you switch it, the Locale.getDefault() switches, too!

The default locale is usually set depending on the users language settings in the android settings. Therefor, you cant rely on it and be 100% sure that the user is actually were he pretends to be.

A god method to deal with payment options and that would be to let the user select a locale at first start of your app and store the information n shared prefs. You can then use that locale for your application.

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