List of usage examples for android.telephony CellSignalStrengthCdma getCdmaEcio
public int getCdmaEcio()
From source file:com.esri.cordova.geolocation.utils.JSONHelper.java
/** * Converts CellInfoCdma into JSON// ww w .j a v a2s . c om * @param cellInfo CellInfoCdma * @return JSON */ public static String cellInfoCDMAJSON(CellInfoCdma cellInfo, boolean returnSignalStrength) { final Calendar calendar = Calendar.getInstance(); final JSONObject json = new JSONObject(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) { try { json.put("provider", CELLINFO_PROVIDER); json.put("type", CDMA); json.put("timestamp", calendar.getTimeInMillis()); final CellIdentityCdma identityCdma = cellInfo.getCellIdentity(); json.put("latitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLatitude())); json.put("longitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLongitude())); json.put("basestationId", identityCdma.getBasestationId()); json.put("networkId", identityCdma.getNetworkId()); json.put("systemId", identityCdma.getSystemId()); if (returnSignalStrength) { final JSONObject jsonSignalStrength = new JSONObject(); final CellSignalStrengthCdma cellSignalStrengthCdma = cellInfo.getCellSignalStrength(); jsonSignalStrength.put("asuLevel", cellSignalStrengthCdma.getAsuLevel()); jsonSignalStrength.put("cdmaDbm", cellSignalStrengthCdma.getCdmaDbm()); jsonSignalStrength.put("cdmaEcio", cellSignalStrengthCdma.getCdmaEcio()); jsonSignalStrength.put("cdmaLevel", cellSignalStrengthCdma.getCdmaLevel()); jsonSignalStrength.put("dbm", cellSignalStrengthCdma.getDbm()); jsonSignalStrength.put("evdoDbm", cellSignalStrengthCdma.getEvdoDbm()); jsonSignalStrength.put("evdoEcio", cellSignalStrengthCdma.getEvdoEcio()); jsonSignalStrength.put("evdoLevel", cellSignalStrengthCdma.getEvdoLevel()); jsonSignalStrength.put("evdoSnr", cellSignalStrengthCdma.getEvdoSnr()); jsonSignalStrength.put("level", cellSignalStrengthCdma.getLevel()); json.put("cellSignalStrengthCdma", jsonSignalStrength); } } catch (JSONException exc) { logJSONException(exc); } } return json.toString(); }