Android Mobilfunk Informationen auslesen - GSM LTE Status Java

On this page we show you how to read information from the mobile network with Android.These features require access to the telephone status as well as access to the location services. If it is not possible, the user is informed about a toast message, because the app checks the permissions at the start.

Android Version API Version
4.0.3 15

Determined data

  • Cell ID (unique ID from the connected cell)
  • LAC (Location Area Code)
  • MCC (Mobile Country Code)
  • MNC (Mobile Network Code)
  • TYPE (Type of network such as GSM, 3G, LTE ...)
  • IMEI (unique ID from phone)
  • NAME (Name of network operator) This code is located in the MainActivity

package com.aeqweb.cellinfo;

import ...

public class MainActivity extends AppCompatActivity {
    TelephonyManager telm;

    protected void onCreate(final Bundle savedInstanceState) {

        if (ContextCompat.checkSelfPermission(MainActivity.this,
                != PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(MainActivity.this, "Please allow phone state access",
        } else {
            if (ContextCompat.checkSelfPermission(MainActivity.this,
                    != PackageManager.PERMISSION_GRANTED) {
                Toast.makeText(MainActivity.this, "Please allow location services",
            } else {
                if (ContextCompat.checkSelfPermission(MainActivity.this,
                        != PackageManager.PERMISSION_GRANTED) {
                    Toast.makeText(MainActivity.this, "Please allow location service",
                } else {
                    telm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
                    TextView cid = (TextView) findViewById(;
                    TextView lac = (TextView) findViewById(;
                    TextView nty = (TextView) findViewById(;
                    TextView mcc = (TextView) findViewById(;
                    TextView mnc = (TextView) findViewById(;
                    TextView imei = (TextView) findViewById(;
                    TextView cname = (TextView) findViewById(;

                    cid.setText("" + cell_id());
                    lac.setText("" + cell_lac());
                    nty.setText("" + networkType());
                    mcc.setText("" + cell_mcc());
                    mnc.setText("" + cell_mnc());
                    imei.setText("" + IMEI());
                    cname.setText("" + networkOperator());

    private int cell_id() {
        GsmCellLocation cellLocation = (GsmCellLocation) telm.getCellLocation();
        return cellLocation.getCid() & 0xffff;

    private int cell_lac() {
        GsmCellLocation cellLocation = (GsmCellLocation) telm.getCellLocation();
        return cellLocation.getLac() & 0xffff;

    private int cell_mcc() {
        String networkOperator = telm.getNetworkOperator();
        if (!TextUtils.isEmpty(networkOperator)) {
            return Integer.parseInt(networkOperator.substring(0, 3));
        } else {
            return 0;

    private int cell_mnc() {
        String networkOperator = telm.getNetworkOperator();
        if (!TextUtils.isEmpty(networkOperator)) {
            return Integer.parseInt(networkOperator.substring(3));
        } else {
            return 0;

    private String networkOperator() {
        return telm.getNetworkOperatorName();

    private String networkType() {
        int networktype = telm.getNetworkType();
        switch (networktype) {
            case TelephonyManager.NETWORK_TYPE_1xRTT:
                return "1xRTT";
            case TelephonyManager.NETWORK_TYPE_CDMA:
                return "CDMA";
            case TelephonyManager.NETWORK_TYPE_EDGE:
                return "EDGE";
            case TelephonyManager.NETWORK_TYPE_EHRPD:
                return "eHRPD";
            case TelephonyManager.NETWORK_TYPE_EVDO_0:
                return "EVDO rev. 0";
            case TelephonyManager.NETWORK_TYPE_EVDO_A:
                return "EVDO rev. A";
            case TelephonyManager.NETWORK_TYPE_EVDO_B:
                return "EVDO rev. B";
            case TelephonyManager.NETWORK_TYPE_GPRS:
                return "GPRS";
            case TelephonyManager.NETWORK_TYPE_HSDPA:
                return "HSDPA";
            case TelephonyManager.NETWORK_TYPE_HSPA:
                return "HSPA";
            case TelephonyManager.NETWORK_TYPE_HSPAP:
                return "HSPA+";
            case TelephonyManager.NETWORK_TYPE_HSUPA:
                return "HSUPA";
            case TelephonyManager.NETWORK_TYPE_IDEN:
                return "iDen";
            case TelephonyManager.NETWORK_TYPE_LTE:
                return "LTE";
            case TelephonyManager.NETWORK_TYPE_UMTS:
                return "UMTS";
            case TelephonyManager.NETWORK_TYPE_UNKNOWN:
                return "Unknown";
        throw new RuntimeException("Unknown");

    public String IMEI() {
        TelephonyManager mngr = (TelephonyManager) getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE);
        String imei = mngr.getDeviceId();
        return imei;

Manifest: These permissions must be defined

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Info: This article has been partially translated automatically and may contain errors.

You Might Also Like


Social Media