Code example for SignalStrength

Methods: getGsmSignalStrength, isGsm, toString

0
 
	private PhoneStateListener mPhoneListener = new PhoneStateListener() {
 
		@Override 
		public void onSignalStrengthsChanged(SignalStrength signalStrength) { 
			Log.v(TAG, "signal strength: " + signalStrength.toString()); 
 
			if (signalStrength.isGsm()) { 
				// GSM 
				int asu = signalStrength.getGsmSignalStrength(); 
				if (asu == 99) { 
					currentCell.signalStrength = -113; // no signal 
				} else { 
					currentCell.signalStrength = -113 + 2 * asu; 
				} 
			} else { 
				// fixme 
				currentCell.signalStrength = signalStrength.getCdmaDbm(); 
			} 
 
		}