Make a Phone Call & Dial Number Using Intent
Intent is asynchronous message between components of application or with other application. Here we will call and feed number to dial-pad from our application to the Android System default Calling application using Intent.
Before moving to the code, we need to implement a run-time permission of android.permission.CALL_PHONE. For detail implementation of run-time, read the blog of Run Time Permission in Android.
Make A Phone Call
Intent call = new Intent(Intent.ACTION_CALL);
call .setData(Uri.parse("tel:+923145553299"));
startActivity(call);
//Note: Replace +923145553299 with your own number
|
Feed Number to Dial-Pad
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:+923145553299"));
startActivity(intent);
//Note: Replace +923145553299 with your own number
|
Comments
Post a Comment