FileDocCategorySizeDatePackage
CellLocation.javaAPI DocAndroid 5.1 API3207Thu Mar 12 22:22:42 GMT 2015android.telephony

CellLocation

public abstract class CellLocation extends Object
Abstract class that represents the location of the device. {@more}

Fields Summary
Constructors Summary
Methods Summary
public abstract voidfillInNotifierBundle(android.os.Bundle bundle)

hide

public static android.telephony.CellLocationgetEmpty()
Return a new CellLocation object representing an unknown location, or null for unknown/none phone radio types.

        // TelephonyManager.getDefault().getCurrentPhoneType() handles the case when
        // ITelephony interface is not up yet.
        switch(TelephonyManager.getDefault().getCurrentPhoneType()) {
        case PhoneConstants.PHONE_TYPE_CDMA:
            return new CdmaCellLocation();
        case PhoneConstants.PHONE_TYPE_GSM:
            return new GsmCellLocation();
        default:
            return null;
        }
    
public abstract booleanisEmpty()

hide

public static android.telephony.CellLocationnewFromBundle(android.os.Bundle bundle)
Create a new CellLocation from a intent notifier Bundle This method is used by PhoneStateIntentReceiver and maybe by external applications.

param
bundle Bundle from intent notifier
return
newly created CellLocation
hide

        // TelephonyManager.getDefault().getCurrentPhoneType() handles the case when
        // ITelephony interface is not up yet.
        switch(TelephonyManager.getDefault().getCurrentPhoneType()) {
        case PhoneConstants.PHONE_TYPE_CDMA:
            return new CdmaCellLocation(bundle);
        case PhoneConstants.PHONE_TYPE_GSM:
            return new GsmCellLocation(bundle);
        default:
            return null;
        }
    
public static voidrequestLocationUpdate()
Request an update of the current location. If the location has changed, a broadcast will be sent to everyone registered with {@link PhoneStateListener#LISTEN_CELL_LOCATION}.

        try {
            ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.getService("phone"));
            if (phone != null) {
                phone.updateServiceLocation();
            }
        } catch (RemoteException ex) {
            // ignore it
        }