Course Content

Course Content

Description

Telephony Services in Android

In today's video our topic is Telephony Services in Android.

Telephony Services we use basically for Calling or SMS applications. For this we need to use TelephonyManager API.

TelephonyManager API enables us to access the native telephony services available or create a user defined telephony application.

TelephonyManager Class is used to determine telephony services and states - IDLE, RINGING, DATA_CONNECTED...

Application can register to receive notification of state changes.

Some telephony information needs permission to be set in the manifest - <uses permission android name="android permission.READ_PHONE_STATE>

The best practice is to use Intents to launch a dialer application to initiate new phone calls. There are two Intent actions you can use to dial a number.

Intent.ACTION_CALL automatically initiates the call, displaying the in call application. We should only use this action if we are replacing the native dialer.

Intent.ACTION_DIAL rather than dial the number immediately, this action starts a dialer application, passing in the specified number but allowing the dialer application to manage the call initialization. This action doesn't require any permissions and is the standard way applications should initiate cells.

The following skeleton code shows the Basic technique for dialling a number,

Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:1234567"));

startActivity(intent);

We can monitor the changes in mobile data connectivity and mobile data transfer by implementing a PhoneStateListener.

Override onDataActivity to track data transfer activity, and onDataConnectionStateChanged to request notifications for data connection state changes.

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere