SignalStrength


public class SignalStrength
extends Object implements Parcelable

java.lang.Object
   ↳ android.telephony.SignalStrength


Contains phone signal strength related information.

Summary

Constants

int INVALID

Indicates the invalid measures of signal strength.

Inherited constants

Fields

public static final Creator<SignalStrength> CREATOR

Parcelable.Creator

Public constructors

SignalStrength(SignalStrength s)

This constructor is used to create a copy of an existing SignalStrength object.

Public methods

int describeContents()

Parcelable#describeContents

boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

int getCdmaDbm()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthCdma#getCdmaDbm.

int getCdmaEcio()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthCdma#getCdmaEcio.

<T extends CellSignalStrength> List<T> getCellSignalStrengths(Class<T> clazz)

Returns a List of CellSignalStrength Components of this SignalStrength Report.

List<CellSignalStrength> getCellSignalStrengths()

Returns a List of CellSignalStrength Components of this SignalStrength Report.

int getEvdoDbm()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthCdma#getEvdoDbm.

int getEvdoEcio()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthCdma#getEvdoEcio.

int getEvdoSnr()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthCdma#getEvdoSnr.

int getGsmBitErrorRate()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthGsm#getBitErrorRate.

int getGsmSignalStrength()

This method was deprecated in API level 29. this information should be retrieved from CellSignalStrengthGsm#getAsuLevel.

int getLevel()

Retrieve an abstract level value for the overall signal strength.

long getTimestampMillis()


Value is a non-negative timestamp in the SystemClock.elapsedRealtime() time base.

int hashCode()

Returns a hash code value for the object.

boolean isGsm()

This method was deprecated in API level 29. This method returns true if there are any 3gpp type SignalStrength elements in this SignalStrength report or if the report contains no valid SignalStrength information. Instead callers should use getCellSignalStrengths() to determine which types of information are contained in the SignalStrength report.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel out, int flags)

Parcelable#writeToParcel

Inherited methods

Constants

INVALID

Added in API level 29
public static final int INVALID

Indicates the invalid measures of signal strength. For example, this can be returned by getEvdoDbm() or getCdmaDbm()

Constant Value: 2147483647 (0x7fffffff)

Fields

CREATOR

Added in API level 30
public static final Creator<SignalStrength> CREATOR

Parcelable.Creator

Public constructors

SignalStrength

Added in API level 31
public SignalStrength (SignalStrength s)

This constructor is used to create a copy of an existing SignalStrength object.

Parameters
s SignalStrength: Source SignalStrength This value cannot be null.

Public methods

describeContents

Added in API level 7
public int describeContents ()

Parcelable#describeContents

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 7
public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o Object: the reference object with which to compare.

Returns
boolean true if the signal strengths are the same

getCdmaDbm

Added in API level 7
Deprecated in API level 29
public int getCdmaDbm ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthCdma#getCdmaDbm.

Get the CDMA RSSI value in dBm

Returns
int the CDMA RSSI value or INVALID if invalid

getCdmaEcio

Added in API level 7
Deprecated in API level 29
public int getCdmaEcio ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthCdma#getCdmaEcio.

Get the CDMA Ec/Io value in dB*10

Returns
int

getCellSignalStrengths

Added in API level 29
public List<T> getCellSignalStrengths (Class<T> clazz)

Returns a List of CellSignalStrength Components of this SignalStrength Report. Use this API to access underlying CellSignalStrength objects that provide more granular information about the SignalStrength report. Only valid (non-empty) CellSignalStrengths will be returned. The order of any returned elements is not guaranteed, and the list may contain more than one instance of a CellSignalStrength type.

Parameters
clazz Class: a class type that extends CellSignalStrength to filter possible return values. This value cannot be null.

Returns
List<T> a List of CellSignalStrength or an empty List if there are no valid measurements. This value cannot be null.

getCellSignalStrengths

Added in API level 29
public List<CellSignalStrength> getCellSignalStrengths ()

Returns a List of CellSignalStrength Components of this SignalStrength Report. Use this API to access underlying CellSignalStrength objects that provide more granular information about the SignalStrength report. Only valid (non-empty) CellSignalStrengths will be returned. The order of any returned elements is not guaranteed, and the list may contain more than one instance of a CellSignalStrength type.

Returns
List<CellSignalStrength> a List of CellSignalStrength or an empty List if there are no valid measurements. This value cannot be null.

getEvdoDbm

Added in API level 7
Deprecated in API level 29
public int getEvdoDbm ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthCdma#getEvdoDbm.

Get the EVDO RSSI value in dBm

Returns
int the EVDO RSSI value or INVALID if invalid

getEvdoEcio

Added in API level 7
Deprecated in API level 29
public int getEvdoEcio ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthCdma#getEvdoEcio.

Get the EVDO Ec/Io value in dB*10

Returns
int

getEvdoSnr

Added in API level 7
Deprecated in API level 29
public int getEvdoSnr ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthCdma#getEvdoSnr.

Get the signal to noise ratio. Valid values are 0-8. 8 is the highest.

Returns
int

getGsmBitErrorRate

Added in API level 7
Deprecated in API level 29
public int getGsmBitErrorRate ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthGsm#getBitErrorRate.

Get the GSM bit error rate (0-7, 99) as defined in TS 27.007 8.5

Returns
int

getGsmSignalStrength

Added in API level 7
Deprecated in API level 29
public int getGsmSignalStrength ()

This method was deprecated in API level 29.
this information should be retrieved from CellSignalStrengthGsm#getAsuLevel.

Get the GSM RSSI in ASU. Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69

Returns
int RSSI in ASU 0..31, 99, or UNAVAILABLE

getLevel

Added in API level 23
public int getLevel ()

Retrieve an abstract level value for the overall signal strength.

Returns
int a single integer from 0 to 4 representing the general signal quality. This may take into account many different radio technology inputs. 0 represents very poor signal strength while 4 represents a very strong signal strength.

getTimestampMillis

Added in API level 30
public long getTimestampMillis ()


Value is a non-negative timestamp in the SystemClock.elapsedRealtime() time base.

Returns
long timestamp in milliseconds since boot for SignalStrength. This timestamp reports the approximate time that the signal was measured and reported by the modem. It can be used to compare the recency of SignalStrength instances. Value is a non-negative timestamp in the SystemClock.elapsedRealtime() time base.

hashCode

Added in API level 7
public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

Returns
int hash code

isGsm

Added in API level 7
Deprecated in API level 29
public boolean isGsm ()

This method was deprecated in API level 29.
This method returns true if there are any 3gpp type SignalStrength elements in this SignalStrength report or if the report contains no valid SignalStrength information. Instead callers should use getCellSignalStrengths() to determine which types of information are contained in the SignalStrength report.

Returns
boolean true if this is for GSM

toString

Added in API level 7
public String toString ()

Returns a string representation of the object.

Returns
String string representation.

writeToParcel

Added in API level 7
public void writeToParcel (Parcel out, 
                int flags)

Parcelable#writeToParcel

Parameters
out Parcel: The Parcel in which the object should be written. This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES