Example usage for android.telephony.gsm GsmCellLocation toString

List of usage examples for android.telephony.gsm GsmCellLocation toString

Introduction

In this page you can find the example usage for android.telephony.gsm GsmCellLocation toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.restcomm.app.qoslib.Services.LibPhoneStateListener.java

private void checkInnerGsmCellLocation(CellLocation cell) {
    if (cell != null) {
        String strCells = "";

        Field getFieldPointer = null;
        try {/*from  w  ww . j  a  v  a 2  s. co  m*/
            getFieldPointer = cell.getClass().getDeclaredField("mGsmCellLoc"); //NoSuchFieldException 

        } catch (Exception e) {
            //MMCLogger.logToFile(MMCLogger.Level.ERROR, TAG, "checkInnerGsmCellLocation","Field does not exist - mGsmCellLoc");
        }
        if (getFieldPointer != null) {
            //now we're in business!
            try {
                getFieldPointer.setAccessible(true);
                GsmCellLocation gsmCell = (GsmCellLocation) getFieldPointer.get(cell);
                if (gsmCell != null) {
                    int bsHigh = gsmCell.getLac();
                    int bsLow = gsmCell.getCid();
                    LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "checkInnerGsmCellLocation",
                            "Obtained mGsmCellLoc LAC=" + gsmCell.getLac() + " toString=" + gsmCell.toString());

                    if (mPhoneState.getNetworkType() == mPhoneState.NETWORK_NEWTYPE_LTE) {
                        int psc = 0;
                        if (android.os.Build.VERSION.SDK_INT >= 10)
                            psc = gsmCell.getPsc();
                        String neighbors = owner.getCellHistory().updateLteNeighborHistory(bsHigh, bsLow, psc);
                        owner.getIntentDispatcher().updateLTEIdentity(neighbors);
                        owner.getReportManager().setNeighbors(neighbors);
                    }
                }
            } catch (Exception e) {
                Log.d(TAG, "Could not get the inner GSM", e);
            }
        }
    }
}