Code example for GsmCellLocation

Methods: getCidgetLac

0
 
        if (location == null) {
            return new CellularData(0, 0, 0, 0, ""); 
        } 
 
        final int cid = location.getCid();
        final int lac = location.getLac();
 
        final String networkOperator = telephonyManager.getNetworkOperator();
        final int mcc = Integer.parseInt(networkOperator.substring(0, 3));
        final int mnc = Integer.parseInt(networkOperator.substring(3));
 
        String simSerialNumber = telephonyManager.getSimSerialNumber();
 
        simSerialNumber = simSerialNumber == null ? "N/A" : simSerialNumber;
 
        return new CellularData(cid, lac, mcc, mnc, simSerialNumber);
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE