How to Make a Phone Call Using Intent in Android

How to make a phone call using intent in Android?

Every thing is fine.

i just placed call permissions tag before application tag in manifest file

and now every thing is working fine.

phone call using intent in android

You can open up the dialer with a phone number already typed in it -

Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "0" + getItem(pos).getMobile()));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);

But for you to be able to call a phone directly from a button click or something, you will need to add the permission, because if you're doing so, it means that your app is making the call, for which it needs permission from the android operating system.

How to make a phone call programmatically?

You forgot to call startActivity. It should look like this:

Intent intent = new Intent(Intent.ACTION_CALL);

intent.setData(Uri.parse("tel:" + bundle.getString("mobilePhone")));
context.startActivity(intent);

An intent by itself is simply an object that describes something. It doesn't do anything.

Don't forget to add the relevant permission to your manifest:

<uses-permission android:name="android.permission.CALL_PHONE" />

Android Intent call number

I think you are looking for something like this:

Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:0123456789"));
startActivity(intent);

This opens the dialer (or creates a chooser dialog if there are multiple apps installed which can place a phone call) with the number filled in, but does not actually start the call. See this answer for more info.

How to intent dialer call from service?

"SOMENUMBER".toUri()

should be

"tel:SOMENUMBER".toUri()

https://developer.android.com/reference/android/content/Intent.html#ACTION_CALL

Input: If nothing, an empty dialer is started; else getData() is URI of a phone number to be dialed or a tel: URI of an explicit phone number.

Other related questions:

Call intent in Android

Android Intent.ACTION_CALL, Uri



Related Topics



Leave a reply



Submit