Android SignalStrength - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SignalStrength class.

This code example shows how to use the following methods:getAsuLevel
        // TODO: use new SignalStrength instead of asu 
        if ((mWants & NOTIF_SIGNAL) == 0) {
            throw new RuntimeException
                ("client must call notifySignalStrength(int)"); 
        } 
        return mSignalStrength.getAsuLevel();
    } 
 
    /** 
     * Return current signal strength in "dBm", ranging from -113 - -51dBm 
     * or -1 if unknown 
     * 
     * @return signal strength in dBm, -1 if not yet updated 
     * Throws RuntimeException if client has not called notifySignalStrength() 
     */ 
    public int getSignalStrengthDbm() { 
        if ((mWants & NOTIF_SIGNAL) == 0) {
            throw new RuntimeException
                ("client must call notifySignalStrength(int)"); 
        } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
		} 
 
		@Override 
		public void onSignalStrengthsChanged(SignalStrength s) {
			super.onSignalStrengthsChanged(s);
			String r = s.getGsmSignalStrength() + ":" + s.getCdmaDbm() + ":"
					+ s.getCdmaEcio() + ":" + s.getEvdoDbm() + ":"
					+ s.getEvdoEcio() + ":" + s.getEvdoSnr() + ":"
					+ s.getGsmBitErrorRate();
			view.loadUrl("javascript:droid.GSM.__onSignalStrengthChange('" + r
					+ "');"); 
		} 
 
		@Override 
		public void onSignalStrengthChanged(int asu) {
			android.util.Log.v("", "onSignalStrengthChanged: " + asu);
		} 
		 
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
		 
		public void onSignalStrengthsChanged (SignalStrength signalStrength)
		{ 
			String strength = "-1";
			if (signalStrength != null) {
				if (signalStrength.isGsm()) {
					strength = "" + signalStrength.getGsmSignalStrength();
				} 
				if (signalStrength.getCdmaDbm() > 0) {
					strength = signalStrength.getCdmaDbm() + "dBm ";
					strength += signalStrength.getCdmaEcio() + "Ec/lo";
				} 
				else if (signalStrength.getEvdoDbm() > 0) {
					strength = signalStrength.getEvdoDbm() + "dBm ";
					strength += signalStrength.getEvdoEcio() + "Ec/lo ";
					strength += signalStrength.getEvdoSnr() + "snr";	
				} 
				getTelephoneManager().listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
				//responseListener.onCompleteSignal(strength); 
				signalResult.gotSignal(strength);
			} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getEvdoDbm, isGsm
		final PhoneStateListener mSignalListener = new PhoneStateListener(){ 
 
			@Override 
			public void onSignalStrengthsChanged(SignalStrength signalStrength) 
			{  
				if (signalStrength.isGsm()) 
					ASU = signalStrength.getGsmSignalStrength(); 
				else{  
					int strength = -1; 
					if (signalStrength.getEvdoDbm() < 0) 
						strength = signalStrength.getEvdoDbm(); 
					else if (signalStrength.getCdmaDbm() < 0) 
						strength = signalStrength.getCdmaDbm(); 
					if (strength < 0){ 
						// convert to asu  
						ASU = Math.round((strength + 113f) / 2f); 
					}  
				}  
				super.onSignalStrengthsChanged(signalStrength);
				StringBuffer output = new StringBuffer();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
		 
		return true; 
	} 
	public void onSignalStrengthsChanged (SignalStrength signalStrength)
	{ 
		values[0] = signalStrength.getCdmaDbm()&0x1;
		bits[0] = 1;
		values[1] = signalStrength.getEvdoDbm()&0x1;
		bits[1] = 1;
		Log.d("Data: ",signalStrength.getCdmaDbm()+", "+signalStrength.getEvdoDbm()+", "+signalStrength.getCdmaEcio()+", "+signalStrength.getEvdoEcio()+", "+signalStrength.getEvdoSnr());
	} 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
            s.append("  LTE RSRQ=").append(getFieldValue(signal, "mLteRsrq"))
                .append('\n');
        } 
 
        // output GSM information. 
        if (signal.isGsm()) {
            s.append("  GSM RSSI=").append(signal.getGsmSignalStrength())
                .append('\n');
            s.append("  GSM bit error rate=")
                .append(signal.getGsmBitErrorRate())
                .append('\n');
        } 
 
        // output CDMA information. 
        s.append("  CDMA RSSI=").append(signal.getCdmaDbm())
            .append('\n');
        s.append("  CDMA ECIO=").append(signal.getCdmaEcio() / 10)
            .append('\n');
 
        // output EVDO information. 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
 
		@Override 
		public void onSignalStrengthsChanged(SignalStrength signalStrength) {
			super.onSignalStrengthsChanged(signalStrength);
 
			boolean	isGsm = signalStrength.isGsm();
			// Get the CDMA RSSI value in dBm 
			int	iCdmaDbm = signalStrength.getCdmaDbm();
			// Get the CDMA Ec/Io value in dB*10 
			int	iCdmaEcio = signalStrength.getCdmaEcio();
			// Get the EVDO RSSI value in dBm 
			int	iEvdoDbm = signalStrength.getEvdoDbm();
			// Get the EVDO Ec/Io value in dB*10 
			int	iEvdoEcio = signalStrength.getEvdoEcio();
			// Get the signal to noise ratio. Valid values are 0-8. 8 is the highest. 
			int	iEvdoSnr = signalStrength.getEvdoSnr();
			// Get the GSM bit error rate (0-7, 99) as defined in TS 27.007 8.5 
			int	iGsmBitErrorRate = signalStrength.getGsmBitErrorRate();
			// Get the GSM Signal Strength, valid values are (0-31, 99) as defined in TS 27.007 8.5 
			int	iGsmSignalStrength = signalStrength.getGsmSignalStrength();

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
 
		@Override 
		public void onSignalStrengthsChanged(SignalStrength signalStrength) { 
			strsig = "ÐźÅÇ¿¶È£º" 
					+ String.valueOf(-113 + 2 
							* signalStrength.getGsmSignalStrength()) 
					+ "  dBm    " 
					+ String.valueOf(signalStrength.getGsmSignalStrength() 
							+ "  asu") + ",ÐźÅGsmBitErrorRate:" 
					+ signalStrength.getGsmBitErrorRate() + ",ÐźÅCdmaDbm:" 
					+ signalStrength.getCdmaDbm() + ",ÐźÅCdmaEcio:" 
					+ signalStrength.getCdmaEcio() + ",ÐźÅEvdoDbm:" 
					+ signalStrength.getEvdoDbm() + ",ÐźÅEvdoEcio:" 
					+ signalStrength.getEvdoEcio() + ",ÐźÅEvdoSnr:" 
					+ signalStrength.getEvdoSnr(); 
		} 
 
	}; 
 
	class MyTimerTask extends TimerTask {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getDbm
    public int getSignalStrengthDbm() { 
        if ((mWants & NOTIF_SIGNAL) == 0) {
            throw new RuntimeException
                ("client must call notifySignalStrength(int)"); 
        } 
        return mSignalStrength.getDbm();
    } 
 
    public void notifyPhoneCallState(int eventWhat) {
        mWants |= NOTIF_PHONE;
        mPhoneStateEventWhat = eventWhat;
        mFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    } 
 
    public boolean getNotifyPhoneCallState() { 
        return ((mWants & NOTIF_PHONE) != 0);
    } 
 
    public void notifyServiceState(int eventWhat) {
        mWants |= NOTIF_SERVICE;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCdmaDbm, getCdmaEcio, getEvdoDbm, getEvdoEcio, getEvdoSnr
		writeServicesStateToLog(state, type, activity);
	} 
	 
	public void onSignalStrengthsChanged(SignalStrength strength) {
		StringBuffer b = new StringBuffer();
		Log.d(TAG, "CdmaDbm: " + strength.getCdmaDbm());
		b.append("CdmaDbm: " + strength.getCdmaDbm() + "\n");
		Log.d(TAG, "CdmaEcio: " + strength.getCdmaEcio());
		b.append("CdmaEcio: " + strength.getCdmaEcio() + "\n");
		Log.d(TAG, "EvdoDbm: " + strength.getEvdoDbm());
		b.append("EvdoDbm: " + strength.getEvdoDbm() + "\n");
		Log.d(TAG, "EvdoEcio: " + strength.getEvdoEcio());
		b.append("EvdoEcio: " + strength.getEvdoEcio() + "\n");
		Log.d(TAG, "EvdoSnr: " + strength.getEvdoSnr());
		b.append("EvdoSnr: " + strength.getEvdoSnr() + "\n");
		Log.d(TAG, "GsmBitErrorRate: " + strength.getGsmBitErrorRate());
		b.append("GsmBitErrorRate: " + strength.getGsmBitErrorRate() + "\n");
		Log.d(TAG, "GsmSignalStrength: " + strength.getGsmSignalStrength());
		// value of our interest 
		b.append("GsmSignalStrength: " + strength.getGsmSignalStrength());

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android SignalStrength Questions & Answers:

See Code Examples for Android SignalStrength Methods: