How to get the name of the operator of the incoming number in android ..?

I can get the name of the carrier using the following snippet:

TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)); String operatorName = telephonyManager.getNetworkOperatorName(); 

This works great.

I can also get the incoming call number using the following snippet:

 private final PhoneStateListener phoneStateListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { String callState = "UNKNOWN"; switch (state) { case TelephonyManager.CALL_STATE_RINGING: } } } 

I want to know the name of the provider / name of the service provider of the incoming number. How can i achieve this?
Is it possible to get an input number, for example, a country?

+2
android telephonymanager
source share
3 answers

It is not possible to get the carrier name of any mobile number using the Android API. At least it's not that simple (and you might get into a privacy issue, I think).

Read this article for more information:

http://sms411.net/2006/07/finding-out-someones-carrier/

Of course, you can try to find the original carrier (using the prefix), but this may differ from the actual one ...

+3
source share

Unable to retrieve caller carrier details. In addition, due to number portability, it is not possible to obtain the operatorโ€™s name from the callerโ€™s phone number. However, you can get country information from the first few digits of the number. For more information, see List of Country Codes .

+2
source share

from API level 22 (Andrid 5.1). These APIs are available.

 SubscriptionManager subscriptionManager = (SubscriptionManager)getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); List<SubscriptionInfo> subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList(); if (subscriptionInfoList != null && subscriptionInfoList.size() > 0) { for (SubscriptionInfo info : subscriptionInfoList) { String carrierName = info.getCarrierName().toString(); String mobileNo = info.getNumber(); String countyIso = info.getCountryIso(); int dataRoaming = info.getDataRoaming(); } } 
0
source share

All Articles