2016-12-07 2 views
0
TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); 

if(tm != null) 
    carrier = tm.getNetworkOperatorName(); 

Je veux juste obtenir le nom de l'opérateur réseau qui est appelé 'carrier'. Mais toujours revenir "" avec l'appareil Android 6. y-a-t'il une solution?Comment puis-je obtenir getNetworkOperatorName() avec android 6.x

+0

Voir commentaire ici http://stackoverflow.com/questions/3838602/how-to-find-out-carriers-name-in-android#comment19751066_3838947 –

+0

Quel appareil Android 6? Un émulateur? Il n'y a pas de support dans un émulateur, probablement –

+0

cette autorisation est-elle présente ou non dans votre code – Piyush

Répondre

1
//Here is snippet, hope it helps you! 
TelephonyManager tManager = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE); 

// Get carrier name (Network Operator Name) 
String carrierName = tManager.getNetworkOperatorName(); 
String operatorName = tManager.getSimOperatorName(); //try this 

// Get Phone model and manufacturer name 
String manufacturer = Build.MANUFACTURER; 
String model = Build.MODEL; 
+0

getCarrierName() – Raman

+0

merci beaucoup! –