How to fetch user country code in android programmatically? I have to show payment in Indian rupees for Indians and in dollars for foreigners but I am not to fetch the user current country. If I use Locale, in some of the mobiles even though they are Indians it is returning US. Please suggest ways using Android.
Method 1: Using the telephone manager
TelephonyManager tm = (TelephonyManager)getActivity().getSystemService(getActivity().TELEPHONY_SERVICE);
String countryCodeValue = tm.getNetworkCountryIso();
But it won't work if there is no sim card in mobile.
Method 2:
Locale.getDefault().
It is returning wrong.