Reputation: 23972
Assuming that I don't know my current location, how to move MapView
to country by it's name?
What I'm trying to do is display user's country by country code in locale.
Upvotes: 2
Views: 137
Reputation: 12058
There isn't such a table in android with a link between country and geolocation that I'am aware of.
I believe the best approach is to get a list of all capital cities with latitude and longitude (you can get them here : list of capital cities) or a list of countries (you can get them from here : list of countries) and put it in a table in your application.
good luck.
Upvotes: 1
Reputation: 3412
Yes you can display User's country by Country Code.
As we have facility to get the CountryCode
through Android Telephony Manager Api
so.
1)You have to use Key Value pairs concept, Key as CountryCode
and Value as Country.
like the following code:
TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
manager.getNetworkCountryIso();
Upvotes: 0