简体   繁体   中英

Google Api to know your current country or current country code

I am actively looking at google api's and I have reached nowhere where google can provide me Country name or Country code under following condition :

1. GPS disabled

2. Location services disabled

Also I got this post Google API for location, based on user IP address

Now read 2nd answer please go to the first link the user has provided.

According to your given conditions, you can use Sim Card to find user's current country.

Following method will give you current country of the user

 getNetworkCountryIso()

Returns the ISO country code equivalent of the current registered operator's MCC (Mobile Country Code).

Usage:

String country = android.telephony.TelephonyManager.getNetworkCountryIso();

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