Example usage for android.telephony.cdma CdmaCellLocation setCellLocationData

List of usage examples for android.telephony.cdma CdmaCellLocation setCellLocationData

Introduction

In this page you can find the example usage for android.telephony.cdma CdmaCellLocation setCellLocationData.

Prototype

public void setCellLocationData(int baseStationId, int baseStationLatitude, int baseStationLongitude,
        int systemId, int networkId) 

Source Link

Document

Set the cell location data.

Usage

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

private void checkCDMACellSID(CellLocation cell) {
    if (cell instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaCell = (CdmaCellLocation) cell;
        if (cdmaCell.getSystemId() <= 0) {
            Field getSIDPointer = null;
            Field getNIDPointer = null;
            int SID = 0, NID = 0, BID = cdmaCell.getBaseStationId();
            try {
                getSIDPointer = mPhoneState.previousServiceStateObj.getClass().getDeclaredField("mSystemId");
                if (getSIDPointer != null) {
                    getSIDPointer.setAccessible(true);
                    SID = (int) getSIDPointer.getInt(cdmaCell);
                }/*from ww  w .j a va2 s .  co  m*/
                getNIDPointer = mPhoneState.previousServiceStateObj.getClass().getDeclaredField("mNetworkId");
                if (getNIDPointer != null) {
                    getNIDPointer.setAccessible(true);
                    NID = (int) getNIDPointer.getInt(cdmaCell);
                }
                cdmaCell.setCellLocationData(BID, cdmaCell.getBaseStationLatitude(),
                        cdmaCell.getBaseStationLongitude(), SID, NID); // Update the SID and NID that we read from teh Servicestate
            } catch (Exception e) {
                //MMCLogger.logToFile(MMCLogger.Level.ERROR, TAG, "checkInnerGsmCellLocation","Field does not exist - mGsmCellLoc");
            }
        }
    }
}