How can I find out carrier's name in Android?
Asked
Active
Viewed 7.5k times
5 Answers
144
Never used it myself, but take a look at TelephonyManager->getNetworkOperatorName().
You could try something as simple as this:
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String carrierName = manager.getNetworkOperatorName();

pableu
- 3,200
- 4
- 23
- 21
-
It does not work if you use Context.getService... should use the initalized context instead of the Class – honcheng May 17 '11 at 10:21
-
1TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); – Someone Somewhere Jun 17 '11 at 00:23
-
1The issue is that the resulting String is not the carrier written in Notification Bar.. For instance, MVNO are not showed. – Waza_Be Oct 30 '11 at 12:32
-
2Does this require a specific permission? – AlikElzin-kilaka Oct 08 '13 at 07:47
-
4@pableu if I am using dual sim mobile means, how can I get the both carrier name? – Karthikeyan Ve Mar 13 '15 at 15:44
-
1@AlikElzin-kilaka there is a manager.getSimOperatorName() method. It returns the same result in normal situation. but it may (and may not, i never tested it) return different result on roaming. If you're concern with roaming it worse to give it a shot. – Alireza Ahmadi Aug 19 '15 at 03:32
-
verified on Android6&7, no need any permission! – DàChún Jun 01 '18 at 08:58
-
is this code same when connected to WIFI? – Shamivul ruvaid Jul 12 '23 at 06:22
26
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
String operatorName = telephonyManager.getNetworkOperatorName();

fhucho
- 34,062
- 40
- 136
- 186
-
-
Won't work for me on Brazil, comes empty. Only the "getSimOperatorName()" -> "Claro BR" – meszias Mar 22 '18 at 16:49
-
Network name is available if there is Network available along with user has selected sim for connecting to internet. Tested this on Android 7 dual sim phone and it returns name only in above condition. Even getSimOperator() behaves in same way atleast on my test phone. – Ankit Apr 26 '19 at 08:50
12
In case one needs the Carrier name of the Operator as shown on the Notifications bar as @Waza_Be asked. One could use the getSimOperatorName method instead, as several Telcos sublease their Network to other companies.
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
String simOperatorName = telephonyManager.getSimOperatorName();

velval
- 3,072
- 36
- 45
-
1it retursn primary sim operator fr dual sim ..how to get ops for both the sim – Srishti Roy Sep 30 '15 at 09:44
-
2Hi @SrishtiRoy, it seems what you need is only supported on API level 22 and above. Check the comments on the accepted answer [here:](http://stackoverflow.com/questions/22170425/get-operator-details-for-dual-sim-android-phone). Android docs [here](https://developer.android.com/reference/android/telephony/SubscriptionManager.html#getActiveSubscriptionInfoList%28%29) – velval Sep 30 '15 at 23:42
1
A Kotlin null safe implementation:
val operatorName = (context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager)?.networkOperatorName ?: "unknown"

Sir Codesalot
- 7,045
- 2
- 50
- 56
0
You could try something LIKE THIS - Latest Working and improved code
IN JAVA
String getCarrierName() {
try {
TelephonyManager manager = (TelephonyManager) OneSignal.appContext.getSystemService(Context.TELEPHONY_SERVICE);
// May throw even though it's not in noted in the Android docs.
// Issue #427
String carrierName = manager.getNetworkOperatorName();
return "".equals(carrierName) ? null : carrierName;
} catch(Throwable t) {
t.printStackTrace();
return null;
}
}
IN KOTLIN
fun getCarrierName(): String? {
return try {
val manager =
App.instance.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
// May throw even though it's not in noted in the Android docs.
// Issue #427
val carrierName = manager.networkOperatorName
if ("" == carrierName) null else carrierName
} catch (t: Throwable) {
t.printStackTrace()
null
}
}

Kumar Santanu
- 603
- 1
- 7
- 14