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.
Up through Android 6.0 (API level 23), Android supported only one or two locales for many common languages (en, es, ar, fr, ru). Because there were only a few variants of each language, apps could get away with storing some numbers and dates as hard coded strings in resource files. This method was deprecated in API level 26. 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: READPHONESTATE or that the calling app has carrier privileges (see hasCarrierPrivileges ).
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.
AndroidManifest.xml
You need to provide READ_PHONE_STATE permission in the AndroidManifest.xml file.
Output:
Next TopicAndroid Call State Example
Document your code
Every project on GitHub comes with a version-controlled wiki to give your documentation the high level of care it deserves. It’s easy to create well-maintained, Markdown or rich text documentation alongside your code.
Sign up for free See pricing for teams and enterprises Terminal Emulator for Android is a VT-100 compatible terminal emulator for Android devices.
Getting Terminal Emulator for Android
Install from Google Play - for Android devices with access to Google Play.
Download from GitHub - for devices without access to Google Play.
Using Terminal Emulator for Android
G+ Community #Android Terminal Emulator - a discussion forum for users to help each other use and improve Terminal Emulator for Android.