I am working on an application which has to expose certain functionality only in certain countries. To enable this I need to find the country of the User. What are the ways I could do this? I can add server support if needed.
What I have looked at so far.
1) Ip geolocation - Should work in most cases, reasonably fast, but not sure how accurate. I have noticed some applications listing some of my colleagues in SG as being in china..
2) Location + reverse Geocoding - Seems more reliable, but requests location services on the device (does it work on wifi only tablets) and for it to be enabled, and requires time to a) fetch location b) server call to reverse geocode
3) Just discovered TelephonyManager and its calls getNetworkCountryIso
and getSimCountryIso
, not sure how these two are different.. This should be very fast, but again only on devices with a SIM.
Timezone and locale based solutions are not feasible since the user might change the locale(by changing the device language) and several countries share timezones.
Are there any other solutions? If none of these are very satisfactory, we might go with multiple APKs, but want to consider all options first
The devices we need to support are 4.1+ Android phones (and soon tablets), particularly Samsung.
There are quite a few related posts for this topic, but most of them focus more on how to achieve one of the solutions, rather than compare and contrast all options. I have also looked at Android Location Strategies, but that again focuses just on how to get the location for #2.
Edit: Just came across LocationProvider.getLastKnownLocation which should be fast, and the likelyhood of inaccuracy probably not too important for me.
Google Play Services has a similar API as well.