Reputation: 643
In my android app I need to get the country, but I can't depend on GPS and Google services as both aren't supported in China. I have tried other methods and nothing works well. Anybody have any other ideas?
Upvotes: 0
Views: 829
Reputation: 3994
Since its a very long comment I will post this as an answer for easy visibility.
Its very hard to find the country without GPS and google service .TelephonyManager won't work if there is no sim in your phone.And Locale won't work if the user in china set his language as English (Means the country you will be getting will be US or UK).If your app requires internet connection then there is an option. Use this api ip-api .But go through there documentation 1st ,if you are planing to use this http://ip-api.com/docs/
There are other api's like this freegeoip api but like you said not sure if it is blocked in china..
Upvotes: 3