Android tutorial - Android TelephonyManager - android app development - android studio - android development tutorial
Learn android - android tutorial - Android telephonymanager - android examples - android programs
Definition of TelephonyManager:
- 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.
- 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.
Android TelephonyManager Example
- Let's see the simple example of TelephonyManager that prints information of the telephony services.
activity_main.xml
- Drag one textview from the pallete, now the xml file will look like this.
File: activity_main.xml
Activity class
- Now, write the code to display the information about the telephony services.
File: MainActivity.java
AndroidManifest.xml
- You need to provide READ_PHONE_STATE permission in the AndroidManifest.xml file