Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gsm network info in android

Tags:

android

gsm

Does someone know how to get gsm information in android? Information like BCCH (Broadcast Control Channel) and BCIS (Base Station Identity Code). I already got the LAC (Location Area Code) and CID (Cell ID). I know that is a low level information but does someone know to get those information? I am having a hard time researching and i don't have an idea about cellular network. Please Help thanks :)

like image 688
GummyBear0014 Avatar asked Nov 28 '13 05:11

GummyBear0014


Video Answer


2 Answers

Here is function which gives you complete information of gsm network. just Call with context from your activity

 private void getNWInfo(Context context) {
          /**
           * <uses-permission android:name="android.permission.READ_PHONE_STATE"
           * /> <uses-permission
           * android:name="android.permission.ACCESS_NETWORK_STATE"/>
           */

          TelephonyManager telephonyManager = (TelephonyManager) context
                       .getSystemService(Context.TELEPHONY_SERVICE);
          String networkOperator = telephonyManager.getNetworkOperator();
          int mcc = 0, mnc = 0;
          if (networkOperator != null) {
                 mcc = Integer.parseInt(networkOperator.substring(0, 3));
                 mnc = Integer.parseInt(networkOperator.substring(3));
          }

          String SimNumber = telephonyManager.getLine1Number();

          String SimSerialNumber = telephonyManager.getSimSerialNumber();
          String countryISO = telephonyManager.getSimCountryIso();
          String operatorName = telephonyManager.getSimOperatorName();
          String operator = telephonyManager.getSimOperator();
          int simState = telephonyManager.getSimState();

          String voicemailNumer = telephonyManager.getVoiceMailNumber();
          String voicemailAlphaTag = telephonyManager.getVoiceMailAlphaTag();

          // Getting connected network iso country code
          String networkCountry = telephonyManager.getNetworkCountryIso();
          // Getting the connected network operator ID
          String networkOperatorId = telephonyManager.getNetworkOperator();
          // Getting the connected network operator name
          String networkName = telephonyManager.getNetworkOperatorName();

          int networkType = telephonyManager.getNetworkType();

          String network = "";
          ConnectivityManager cm = (ConnectivityManager) context
                       .getSystemService(Context.CONNECTIVITY_SERVICE);
          try {
                 if (cm.getActiveNetworkInfo().getTypeName().equals("MOBILE"))
                       network = "Cell Network/3G";
                 else if (cm.getActiveNetworkInfo().getTypeName().equals("WIFI"))
                       network = "WiFi";
                 else
                       network = "N/A";
          } catch (Exception e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
          }

          TextView  textView = (TextView) findViewById(R.id.textView);
          textView.setText("network :" + network +

          "\n" + "countryISO : " + countryISO + "\n" + "operatorName : "
                       + operatorName + "\n" + "operator :      " + operator + "\n"
                       + "simState :" + simState + "\n" + "Sim Serial Number : "
                       + SimSerialNumber + "\n" + "Sim Number : " + SimNumber + "\n"
                       + "Voice Mail Numer" + voicemailNumer + "\n"
                       + "Voice Mail Alpha Tag" + voicemailAlphaTag + "\n"
                       + "Sim State" + simState + "\n" + "Mobile Country Code MCC : "
                       + mcc + "\n" + "Mobile Network Code MNC : " + mnc + "\n"
                       + "Network Country : " + networkCountry + "\n"
                       + "Network OperatorId : " + networkOperatorId + "\n"
                       + "Network Name : " + networkName + "\n" + "Network Type : "
                       + networkType);


   }

you can find more details on this blog

http://khurramitdeveloper.blogspot.in/search?updated-max=2013-11-07T03:23:00-08:00&max-results=7

hope it will help you :)

like image 180
khurram Avatar answered Sep 19 '22 12:09

khurram


Please visit here. It explains that no APIs are available to get the Radio Information.

like image 23
Anchit Mittal Avatar answered Sep 19 '22 12:09

Anchit Mittal