IT. Expert System.

Android Reference

TelephonyManager


android.telephony

Class TelephonyManager



  • public class TelephonyManager
    extends Object
    Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information. Applications can also register a listener to receive notification of telephony state changes.

    You do not instantiate this class directly; instead, you retrieve a reference to an instance through Context.getSystemService(Context.TELEPHONY_SERVICE).

    Note that access to some telephony information is permission-protected. Your application cannot access the protected information unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the the methods through which you access the protected information.

    • Field Detail

      • PHONE_TYPE_GSM

        public static final int PHONE_TYPE_GSM
        Phone radio is GSM.
        See Also:
        Constant Field Values
      • PHONE_TYPE_CDMA

        public static final int PHONE_TYPE_CDMA
        Phone radio is CDMA.
        See Also:
        Constant Field Values
      • NETWORK_TYPE_UNKNOWN

        public static final int NETWORK_TYPE_UNKNOWN
        Network type is unknown
        See Also:
        Constant Field Values
      • NETWORK_TYPE_GPRS

        public static final int NETWORK_TYPE_GPRS
        Current network is GPRS
        See Also:
        Constant Field Values
      • NETWORK_TYPE_EDGE

        public static final int NETWORK_TYPE_EDGE
        Current network is EDGE
        See Also:
        Constant Field Values
      • NETWORK_TYPE_UMTS

        public static final int NETWORK_TYPE_UMTS
        Current network is UMTS
        See Also:
        Constant Field Values
      • NETWORK_TYPE_CDMA

        public static final int NETWORK_TYPE_CDMA
        Current network is CDMA: Either IS95A or IS95B
        See Also:
        Constant Field Values
      • NETWORK_TYPE_EVDO_0

        public static final int NETWORK_TYPE_EVDO_0
        Current network is EVDO revision 0
        See Also:
        Constant Field Values
      • NETWORK_TYPE_EVDO_A

        public static final int NETWORK_TYPE_EVDO_A
        Current network is EVDO revision A
        See Also:
        Constant Field Values
      • NETWORK_TYPE_1xRTT

        public static final int NETWORK_TYPE_1xRTT
        Current network is 1xRTT
        See Also:
        Constant Field Values
      • NETWORK_TYPE_HSDPA

        public static final int NETWORK_TYPE_HSDPA
        Current network is HSDPA
        See Also:
        Constant Field Values
      • NETWORK_TYPE_HSUPA

        public static final int NETWORK_TYPE_HSUPA
        Current network is HSUPA
        See Also:
        Constant Field Values
      • NETWORK_TYPE_HSPA

        public static final int NETWORK_TYPE_HSPA
        Current network is HSPA
        See Also:
        Constant Field Values
      • NETWORK_TYPE_IDEN

        public static final int NETWORK_TYPE_IDEN
        Current network is iDen
        See Also:
        Constant Field Values
      • NETWORK_TYPE_EVDO_B

        public static final int NETWORK_TYPE_EVDO_B
        Current network is EVDO revision B
        See Also:
        Constant Field Values
      • NETWORK_TYPE_LTE

        public static final int NETWORK_TYPE_LTE
        Current network is LTE
        See Also:
        Constant Field Values
      • NETWORK_TYPE_EHRPD

        public static final int NETWORK_TYPE_EHRPD
        Current network is eHRPD
        See Also:
        Constant Field Values
      • NETWORK_TYPE_HSPAP

        public static final int NETWORK_TYPE_HSPAP
        Current network is HSPA+
        See Also:
        Constant Field Values
      • NETWORK_CLASS_UNKNOWN

        public static final int NETWORK_CLASS_UNKNOWN
        Unknown network class.
        See Also:
        Constant Field Values
      • NETWORK_CLASS_2_G

        public static final int NETWORK_CLASS_2_G
        Class of broadly defined "2G" networks.
        See Also:
        Constant Field Values
      • NETWORK_CLASS_3_G

        public static final int NETWORK_CLASS_3_G
        Class of broadly defined "3G" networks.
        See Also:
        Constant Field Values
      • NETWORK_CLASS_4_G

        public static final int NETWORK_CLASS_4_G
        Class of broadly defined "4G" networks.
        See Also:
        Constant Field Values
      • SIM_STATE_UNKNOWN

        public static final int SIM_STATE_UNKNOWN
        SIM card state: Unknown. Signifies that the SIM is in transition between states. For example, when the user inputs the SIM pin under PIN_REQUIRED state, a query for sim status returns this state before turning to SIM_STATE_READY.
        See Also:
        Constant Field Values
      • SIM_STATE_ABSENT

        public static final int SIM_STATE_ABSENT
        SIM card state: no SIM card is available in the device
        See Also:
        Constant Field Values
      • SIM_STATE_PIN_REQUIRED

        public static final int SIM_STATE_PIN_REQUIRED
        SIM card state: Locked: requires the user's SIM PIN to unlock
        See Also:
        Constant Field Values
      • SIM_STATE_PUK_REQUIRED

        public static final int SIM_STATE_PUK_REQUIRED
        SIM card state: Locked: requires the user's SIM PUK to unlock
        See Also:
        Constant Field Values
      • SIM_STATE_NETWORK_LOCKED

        public static final int SIM_STATE_NETWORK_LOCKED
        SIM card state: Locked: requries a network PIN to unlock
        See Also:
        Constant Field Values
      • SIM_STATE_READY

        public static final int SIM_STATE_READY
        SIM card state: Ready
        See Also:
        Constant Field Values
      • CALL_STATE_IDLE

        public static final int CALL_STATE_IDLE
        Device call state: No activity.
        See Also:
        Constant Field Values
      • CALL_STATE_RINGING

        public static final int CALL_STATE_RINGING
        Device call state: Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active.
        See Also:
        Constant Field Values
      • CALL_STATE_OFFHOOK

        public static final int CALL_STATE_OFFHOOK
        Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.
        See Also:
        Constant Field Values
      • DATA_ACTIVITY_NONE

        public static final int DATA_ACTIVITY_NONE
        Data connection activity: No traffic.
        See Also:
        Constant Field Values
      • DATA_ACTIVITY_IN

        public static final int DATA_ACTIVITY_IN
        Data connection activity: Currently receiving IP PPP traffic.
        See Also:
        Constant Field Values
      • DATA_ACTIVITY_OUT

        public static final int DATA_ACTIVITY_OUT
        Data connection activity: Currently sending IP PPP traffic.
        See Also:
        Constant Field Values
      • DATA_ACTIVITY_INOUT

        public static final int DATA_ACTIVITY_INOUT
        Data connection activity: Currently both sending and receiving IP PPP traffic.
        See Also:
        Constant Field Values
      • DATA_ACTIVITY_DORMANT

        public static final int DATA_ACTIVITY_DORMANT
        Data connection is active, but physical link is down
        See Also:
        Constant Field Values
      • DATA_UNKNOWN

        public static final int DATA_UNKNOWN
        Data connection state: Unknown. Used before we know the state.
        See Also:
        Constant Field Values
      • DATA_DISCONNECTED

        public static final int DATA_DISCONNECTED
        Data connection state: Disconnected. IP traffic not available.
        See Also:
        Constant Field Values
      • DATA_CONNECTING

        public static final int DATA_CONNECTING
        Data connection state: Currently setting up a data connection.
        See Also:
        Constant Field Values
      • DATA_CONNECTED

        public static final int DATA_CONNECTED
        Data connection state: Connected. IP traffic should be available.
        See Also:
        Constant Field Values
      • DATA_SUSPENDED

        public static final int DATA_SUSPENDED
        Data connection state: Suspended. The connection is up, but IP traffic is temporarily unavailable. For example, in a 2G network, data activity may be suspended when a voice call arrives.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TelephonyManager

        public TelephonyManager(Context context)
    • Method Detail

      • getDeviceSoftwareVersion

        public String getDeviceSoftwareVersion()
        Returns the software version number for the device, for example, the IMEI/SV for GSM phones. Return null if the software version is not available.

        Requires Permission: READ_PHONE_STATE

      • getDeviceId

        public String getDeviceId()
        Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones. Return null if device ID is not available.

        Requires Permission: READ_PHONE_STATE

      • getCellLocation

        public CellLocation getCellLocation()
        Returns the current location of the device. Return null if current location is not available.

        Requires Permission: ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION.

      • enableLocationUpdates

        public void enableLocationUpdates()
        Enables location update notifications. PhoneStateListener.onCellLocationChanged will be called on location updates.

        Requires Permission: CONTROL_LOCATION_UPDATES

      • disableLocationUpdates

        public void disableLocationUpdates()
        Disables location update notifications. PhoneStateListener.onCellLocationChanged will be called on location updates.

        Requires Permission: CONTROL_LOCATION_UPDATES

      • getNeighboringCellInfo

        public List<NeighboringCellInfo> getNeighboringCellInfo()
        Returns the neighboring cell information of the device.
        Returns:
        List of NeighboringCellInfo or null if info unavailable.

        Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}

      • getPhoneType

        public static int getPhoneType(int networkMode)
        This function returns the type of the phone, depending on the network mode.
        Parameters:
        network - mode
        Returns:
        Phone Type
      • getLteOnCdmaModeStatic

        public static int getLteOnCdmaModeStatic()
        Return if the current radio is LTE on CDMA. This is a tri-state return value as for a period of time the mode may be unknown.
        Returns:
        PhoneConstants.LTE_ON_CDMA_UNKNOWN, PhoneConstants.LTE_ON_CDMA_FALSE or PhoneConstants.LTE_ON_CDMA_TRUE
      • getNetworkOperatorName

        public String getNetworkOperatorName()
        Returns the alphabetic name of current registered operator.

        Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).

      • getNetworkOperator

        public String getNetworkOperator()
        Returns the numeric name (MCC+MNC) of current registered operator.

        Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).

      • isNetworkRoaming

        public boolean isNetworkRoaming()
        Returns true if the device is considered roaming on the current network, for GSM purposes.

        Availability: Only when user registered to a network.

      • getNetworkCountryIso

        public String getNetworkCountryIso()
        Returns the ISO country code equivalent of the current registered operator's MCC (Mobile Country Code).

        Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).

      • getNetworkClass

        public static int getNetworkClass(int networkType)
        Return general class of network type, such as "3G" or "4G". In cases where classification is contentious, this method is conservative.
      • getNetworkTypeName

        public String getNetworkTypeName()
        Returns a string representation of the radio technology (network type) currently in use on the device.
        Returns:
        the name of the radio technology
      • getNetworkTypeName

        public static String getNetworkTypeName(int type)
      • hasIccCard

        public boolean hasIccCard()
        Returns:
        true if a ICC card is present
      • getSimOperator

        public String getSimOperator()
        Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM. 5 or 6 decimal digits.

        Availability: SIM state must be SIM_STATE_READY

        See Also:
        getSimState()
      • getSimCountryIso

        public String getSimCountryIso()
        Returns the ISO country code equivalent for the SIM provider's country code.
      • getSimSerialNumber

        public String getSimSerialNumber()
        Returns the serial number of the SIM, if applicable. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getLteOnCdmaMode

        public int getLteOnCdmaMode()
        Return if the current radio is LTE on CDMA. This is a tri-state return value as for a period of time the mode may be unknown.
        Returns:
        Phone#LTE_ON_CDMA_UNKNOWN, Phone#LTE_ON_CDMA_FALSE or Phone#LTE_ON_CDMA_TRUE
      • getSubscriberId

        public String getSubscriberId()
        Returns the unique subscriber ID, for example, the IMSI for a GSM phone. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getLine1Number

        public String getLine1Number()
        Returns the phone number string for line 1, for example, the MSISDN for a GSM phone. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getLine1AlphaTag

        public String getLine1AlphaTag()
        Returns the alphabetic identifier associated with the line 1 number. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getMsisdn

        public String getMsisdn()
        Returns the MSISDN string. for a GSM phone. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getVoiceMailNumber

        public String getVoiceMailNumber()
        Returns the voice mail number. Return null if it is unavailable.

        Requires Permission: READ_PHONE_STATE

      • getCompleteVoiceMailNumber

        public String getCompleteVoiceMailNumber()
        Returns the complete voice mail number. Return null if it is unavailable.

        Requires Permission: CALL_PRIVILEGED

      • getVoiceMessageCount

        public int getVoiceMessageCount()
        Returns the voice mail count. Return 0 if unavailable.

        Requires Permission: READ_PHONE_STATE

      • getVoiceMailAlphaTag

        public String getVoiceMailAlphaTag()
        Retrieves the alphabetic identifier associated with the voice mail number.

        Requires Permission: READ_PHONE_STATE

      • getIsimImpi

        public String getIsimImpi()
        Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
        Returns:
        the IMPI, or null if not present or not loaded
      • getIsimDomain

        public String getIsimDomain()
        Returns the IMS home network domain name that was loaded from the ISIM.
        Returns:
        the IMS domain name, or null if not present or not loaded
      • getIsimImpu

        public String[] getIsimImpu()
        Returns the IMS public user identities (IMPU) that were loaded from the ISIM.
        Returns:
        an array of IMPU strings, with one IMPU per string, or null if not present or not loaded
      • getCallState

        public int getCallState()
        Returns a constant indicating the call state (cellular) on the device.
      • listen

        public void listen(PhoneStateListener listener,
                  int events)
        Registers a listener object to receive notification of changes in specified telephony states.

        To register a listener, pass a PhoneStateListener and specify at least one telephony state of interest in the events argument. At registration, and when a specified telephony state changes, the telephony manager invokes the appropriate callback method on the listener object and passes the current (udpated) values.

        To unregister a listener, pass the listener object and set the events argument to LISTEN_NONE (0).

        Parameters:
        listener - The PhoneStateListener object to register (or unregister)
        events - The telephony state(s) of interest to the listener, as a bitwise-OR combination of PhoneStateListener LISTEN_ flags.
      • getCdmaEriIconIndex

        public int getCdmaEriIconIndex()
        Returns the CDMA ERI icon index to display
      • getCdmaEriIconMode

        public int getCdmaEriIconMode()
        Returns the CDMA ERI icon mode, 0 - ON 1 - FLASHING
      • getCdmaEriText

        public String getCdmaEriText()
        Returns the CDMA ERI text,
      • isVoiceCapable

        public boolean isVoiceCapable()
        Returns:
        true if the current device is "voice capable".

        "Voice capable" means that this device supports circuit-switched (i.e. voice) phone calls over the telephony network, and is allowed to display the in-call UI while a cellular voice call is active. This will be false on "data only" devices which can't make voice calls and don't support any in-call UI.

        Note: the meaning of this flag is subtly different from the PackageManager.FEATURE_TELEPHONY system feature, which is available on any device with a telephony radio, even if the device is data-only.

      • isSmsCapable

        public boolean isSmsCapable()
        Returns:
        true if the current device supports sms service.

        If true, this means that the device supports both sending and receiving sms via the telephony network.

        Note: Voicemail waiting sms, cell broadcasting sms, and MMS are disabled when device doesn't support sms.

      • getAllCellInfo

        public List<CellInfo> getAllCellInfo()
        Returns all observed cell information of the device.
        Returns:
        List of CellInfo or null if info unavailable.

        Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 929 / 158735907. Delta: 0.04429 с