FileDocCategorySizeDatePackage
SmsCbLocation.javaAPI DocAndroid 5.1 API5761Thu Mar 12 22:22:54 GMT 2015android.telephony

SmsCbLocation

public class SmsCbLocation extends Object implements android.os.Parcelable
Represents the location and geographical scope of a cell broadcast message. For GSM/UMTS, the Location Area and Cell ID are set when the broadcast geographical scope is cell wide or Location Area wide. For CDMA, the broadcast geographical scope is always PLMN wide.
hide

Fields Summary
private final String
mPlmn
The PLMN. Note that this field may be an empty string, but isn't allowed to be null.
private final int
mLac
private final int
mCid
public static final Parcelable.Creator
CREATOR
Constructors Summary
public SmsCbLocation()
Construct an empty location object. This is used for some test cases, and for cell broadcasts saved in older versions of the database without location info.

        mPlmn = "";
        mLac = -1;
        mCid = -1;
    
public SmsCbLocation(String plmn)
Construct a location object for the PLMN. This class is immutable, so the same object can be reused for multiple broadcasts.

        mPlmn = plmn;
        mLac = -1;
        mCid = -1;
    
public SmsCbLocation(String plmn, int lac, int cid)
Construct a location object for the PLMN, LAC, and Cell ID. This class is immutable, so the same object can be reused for multiple broadcasts.

        mPlmn = plmn;
        mLac = lac;
        mCid = cid;
    
public SmsCbLocation(android.os.Parcel in)
Initialize the object from a Parcel.

        mPlmn = in.readString();
        mLac = in.readInt();
        mCid = in.readInt();
    
Methods Summary
public intdescribeContents()
Describe the kinds of special objects contained in the marshalled representation.

return
a bitmask indicating this Parcelable contains no special objects


                              
    
       
        return 0;
    
public booleanequals(java.lang.Object o)

        if (o == this) {
            return true;
        }
        if (o == null || !(o instanceof SmsCbLocation)) {
            return false;
        }
        SmsCbLocation other = (SmsCbLocation) o;
        return mPlmn.equals(other.mPlmn) && mLac == other.mLac && mCid == other.mCid;
    
public intgetCid()
Returns the GSM or UMTS cell ID.

return
gsm cell id, -1 if unknown, 0xffff max legal value

        return mCid;
    
public intgetLac()
Returns the GSM location area code, or UMTS service area code.

return
location area code, -1 if unknown, 0xffff max legal value

        return mLac;
    
public java.lang.StringgetPlmn()
Returns the MCC/MNC of the network as a String.

return
the PLMN identifier (MCC+MNC) as a String

        return mPlmn;
    
public inthashCode()

        int hash = mPlmn.hashCode();
        hash = hash * 31 + mLac;
        hash = hash * 31 + mCid;
        return hash;
    
public booleanisInLocationArea(android.telephony.SmsCbLocation area)
Test whether this location is within the location area of the specified object.

param
area the location area to compare with this location
return
true if this location is contained within the specified location area

        if (mCid != -1 && mCid != area.mCid) {
            return false;
        }
        if (mLac != -1 && mLac != area.mLac) {
            return false;
        }
        return mPlmn.equals(area.mPlmn);
    
public booleanisInLocationArea(java.lang.String plmn, int lac, int cid)
Test whether this location is within the location area of the CellLocation.

param
plmn the PLMN to use for comparison
param
lac the Location Area (GSM) or Service Area (UMTS) to compare with
param
cid the Cell ID to compare with
return
true if this location is contained within the specified PLMN, LAC, and Cell ID

        if (!mPlmn.equals(plmn)) {
            return false;
        }

        if (mLac != -1 && mLac != lac) {
            return false;
        }

        if (mCid != -1 && mCid != cid) {
            return false;
        }

        return true;
    
public java.lang.StringtoString()

        return '[" + mPlmn + '," + mLac + '," + mCid + ']";
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Flatten this object into a Parcel.

param
dest The Parcel in which the object should be written.
param
flags Additional flags about how the object should be written (ignored).

        dest.writeString(mPlmn);
        dest.writeInt(mLac);
        dest.writeInt(mCid);