Skip to content
MrDhruv edited this page May 15, 2018 · 11 revisions

Telephony manager, which is part of the Android application framework, provides a telephony API to user applications. It consists of the android.telephony and android.telephony.gsm Java packages.

Telecom framework overview

The Android Telecom framework manages audio and video calls on an Android device. This includes SIM-based calls (e.g. using the Telephony framework) as well as VOIP calls provided by implementors of the ConnectionService API.

VoIP is short for Voice over Internet Protocol. Voice over Internet Protocol is a category of hardware and software that enables people to use the Internet as the transmission medium for telephone calls by sending voice data in packets using IP rather than by traditional circuit transmissions of the PSTN. 

==>The two major components which Telecom deals with are ConnectionServices and InCallServices.

    A ConnectionService implementation is responsible for connecting calls to another party using some means (e.g. VOIP). The most common ConnectionService implementation on a phone is the Telephony ConnectionService which is responsible for connecting carrier calls.
    A InCallService implementation is responsible for providing a user interface to calls managed by Telecom and for providing the user with a means to control and interact with these calls. The Phone app bundled with a device is the most common example of an implementation of an InCallService .

e.g. The android.telephony.TelephonyManager class provides information about the telephony services such as subscriber id, sim serial number, phone network type etc. Moreover, you can determine the phone state etc.


//Get the instance of TelephonyManager
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    //Calling the methods of TelephonyManager the returns the information  
    String IMEINumber=tm.getDeviceId();  
    String subscriberID=tm.getDeviceId();  
    String SIMSerialNumber=tm.getSimSerialNumber();  
    String networkCountryISO=tm.getNetworkCountryIso();  
    String SIMCountryISO=tm.getSimCountryIso();  
    String softwareVersion=tm.getDeviceSoftwareVersion();  
    String voiceMailNumber=tm.getVoiceMailNumber();  
      
    //Get the phone type  
    String strphoneType="";  
      
    int phoneType=tm.getPhoneType();  

    switch (phoneType)   
    {  
            case (TelephonyManager.PHONE_TYPE_CDMA):  
                       strphoneType="CDMA";  
                           break;  
            case (TelephonyManager.PHONE_TYPE_GSM):   
                       strphoneType="GSM";                
                           break;  
            case (TelephonyManager.PHONE_TYPE_NONE):  
                        strphoneType="NONE";                
                            break;  
     }  
      
    //getting information if phone is in roaming  
    boolean isRoaming=tm.isNetworkRoaming();  

Android Manifest file required following permission

uses-permission android:name="android.permission.READ_PHONE_STATE"

Telephony Manager file
Clone this wiki locally