问题
I have to get phone no region (means from which region this no belongs) programmatically. I searched lot and didn't find anyway then I thought to get current location through network provider name but it return city name. Actually 1st I have to get phone no region if it not possible then through network provider how can we get region of current location. Please suggest me.
回答1:
Try Telephony Service.
TelephonyManager telman=(TelephonyManager) getSystemService(TELEPHONY_SERVICE);
a lot of info can retrieve as,
telman.getNetworkOperatorName();
telman.getSimSerialNumber();
telman.getLine1Number();
telman.getSubscriberId();
etc.
There is a method, telman.getCellLocation();
. I didn't try it yet, may be you can try.
回答2:
The easiest way to get the name of the Current Network Operator to which the Android phone is currently connected is to get hold of the android.telephony.TelephonyManager and get it from there:
TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));
String operatorName = telephonyManager.getNetworkOperatorName();
similarly the sim operator can be retrieved by using:
String operatorName = telephonyManager.getSimOperatorName();
来源:https://stackoverflow.com/questions/17942150/get-phone-region-name-programmatically