NeighboringCellInfo

public class NeighboringCellInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.telephony.NeighboringCellInfo


This class was deprecated in API level 29.
This class should not be used by any app targeting Android Q or higher. Instead callers should use CellInfo.

Represents the neighboring cell information, including Received Signal Strength and Cell ID location.

Summary

Constants

int UNKNOWN_CID

Cell location is not available

int UNKNOWN_RSSI

Signal strength is not available

Inherited constants

Fields

public static final Creator<NeighboringCellInfo> CREATOR

Public constructors

NeighboringCellInfo()

This constructor is deprecated. by NeighboringCellInfo(int, java.lang.String, int)

NeighboringCellInfo(int rssi, int cid)

This constructor is deprecated. by NeighboringCellInfo(int, java.lang.String, int)

NeighboringCellInfo(int rssi, String location, int radioType)

Initialize the object from rssi, location string, and radioType radioType is one of following TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, and TelephonyManager.NETWORK_TYPE_HSPA.

NeighboringCellInfo(Parcel in)

Initialize the object from a parcel.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getCid()
int getLac()
int getNetworkType()
int getPsc()
int getRssi()
void setCid(int cid)

This method was deprecated in API level 15. cid value passed as in location parameter passed to constructor NeighboringCellInfo(int, java.lang.String, int)

void setRssi(int rssi)

This method was deprecated in API level 15. initial rssi value passed as parameter to constructor NeighboringCellInfo(int, java.lang.String, int)

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

UNKNOWN_CID

Added in API level 3
public static final int UNKNOWN_CID

Cell location is not available

Constant Value: -1 (0xffffffff)

UNKNOWN_RSSI

Added in API level 3
public static final int UNKNOWN_RSSI

Signal strength is not available

Constant Value: 99 (0x00000063)

Fields

CREATOR

Added in API level 3
public static final Creator<NeighboringCellInfo> CREATOR

Public constructors

NeighboringCellInfo

Added in API level 3
public NeighboringCellInfo ()

This constructor is deprecated.
by NeighboringCellInfo(int, java.lang.String, int)

Empty constructor. Initializes the RSSI and CID. NeighboringCellInfo is one time shot for the neighboring cells based on the radio network type at that moment. Its constructor needs radio network type.

NeighboringCellInfo

Added in API level 3
public NeighboringCellInfo (int rssi, 
                int cid)

This constructor is deprecated.
by NeighboringCellInfo(int, java.lang.String, int)

Initialize the object from rssi and cid. NeighboringCellInfo is one time shot for the neighboring cells based on the radio network type at that moment. Its constructor needs radio network type.

Parameters
rssi int

cid int

NeighboringCellInfo

Added in API level 3
public NeighboringCellInfo (int rssi, 
                String location, 
                int radioType)

Initialize the object from rssi, location string, and radioType radioType is one of following TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, and TelephonyManager.NETWORK_TYPE_HSPA.

Parameters
rssi int

location String

radioType int

NeighboringCellInfo

Added in API level 3
public NeighboringCellInfo (Parcel in)

Initialize the object from a parcel.

Parameters
in Parcel

Public methods

describeContents

Added in API level 3
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

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

getCid

Added in API level 3
public int getCid ()

Returns
int cell id in GSM, 0xffff max legal value UNKNOWN_CID if in UMTS or CDMA or unknown

getLac

Added in API level 5
Deprecated in API level 29
public int getLac ()

Returns
int LAC in GSM, 0xffff max legal value UNKNOWN_CID if in UMTS or CMDA or unknown

getNetworkType

Added in API level 5
Deprecated in API level 29
public int getNetworkType ()

Returns
int Radio network type while neighboring cell location is stored. Return TelephonyManager.NETWORK_TYPE_UNKNOWN means that the location information is unavailable. Return TelephonyManager.NETWORK_TYPE_GPRS or TelephonyManager.NETWORK_TYPE_EDGE means that Neighboring Cell information is stored for GSM network, in which NeighboringCellInfo.getLac and NeighboringCellInfo.getCid should be called to access location. Return TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, or TelephonyManager.NETWORK_TYPE_HSPA means that Neighboring Cell information is stored for UMTS network, in which NeighboringCellInfo.getPsc should be called to access location.

getPsc

Added in API level 5
Deprecated in API level 29
public int getPsc ()

Returns
int Primary Scrambling Code in 9 bits format in UMTS, 0x1ff max value UNKNOWN_CID if in GSM or CMDA or unknown

getRssi

Added in API level 3
public int getRssi ()

Returns
int received signal strength or UNKNOWN_RSSI if unknown For GSM, it is in "asu" ranging from 0 to 31 (dBm = -113 + 2*asu) 0 means "-113 dBm or less" and 31 means "-51 dBm or greater" For UMTS, it is the Level index of CPICH RSCP defined in TS 25.125

setCid

Added in API level 3
Deprecated in API level 15
public void setCid (int cid)

This method was deprecated in API level 15.
cid value passed as in location parameter passed to constructor NeighboringCellInfo(int, java.lang.String, int)

Set the cell id. NeighboringCellInfo is a one time shot for the neighboring cells based on the radio network type at that moment. It shouldn't be changed after creation.

Parameters
cid int

setRssi

Added in API level 3
Deprecated in API level 15
public void setRssi (int rssi)

This method was deprecated in API level 15.
initial rssi value passed as parameter to constructor NeighboringCellInfo(int, java.lang.String, int)

Set the signal strength of the cell. NeighboringCellInfo is a one time shot for the neighboring cells based on the radio network type at that moment. It shouldn't be changed after creation.

Parameters
rssi int

toString

Added in API level 3
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 3
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest 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