When my app runs, I want to detect the current location's country name and do some stuff for that specific country name, I can easily do it using geocoder, gps. But I want to get it from Locale or if anything more is available.
Use this link http://ip-api.com/json ,this will provide all the information as json. From this json you can get the country easily. This site works using your current IP,it automatically detects the IP and sendback details.
Docs http://ip-api.com/docs/api:json Hope it helps.
This is what I got.
{
"as": "AS55410 C48 Okhla Industrial Estate, New Delhi-110020",
"city": "Kochi",
"country": "India",
"countryCode": "IN",
"isp": "Vodafone India",
"lat": 9.9667,
"lon": 76.2333,
"org": "Vodafone India",
"query": "123.63.81.162",
"region": "KL",
"regionName": "Kerala",
"status": "success",
"timezone": "Asia/Kolkata",
"zip": ""
}
I dont know if Android API allowes you to check the Provider Code of the associated GSM Network. If this is possible you could use this Code an check i.e. against this List : http://www.techgsm.com/page/gsm-provider-codes/network-provider-identify-codes.html to find out in which country the Cellphone is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With