Sanjana Nair
Sanjana Nair

Reputation: 2785

Making calls programmatically in Samsung Devices in Android

I am trying to make a call using the following code:

String phoneNumber = unItemVal.getText().toString();
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + phoneNumber));
startActivity(callIntent);

Call is getting initiated using Nexus 5 but when I try the same code on Samsung device it doesn't do anything.

What is the difference between Nexus 5 and Samsung Devices?

Thanks!

Upvotes: 1

Views: 162

Answers (1)

cybersam
cybersam

Reputation: 67044

[EDITED]

Try using Action.PHONE_DIAL instead. (In your code, replace ACTION_CALL with ACTION_DIAL).

Action.PHONE_CALL is not guaranteed to work for all apps. Quoting from the Javadoc:

Note: there will be restrictions on which applications can initiate a call; most applications should use the ACTION_DIAL.

Note: this Intent cannot be used to call emergency numbers. Applications can dial emergency numbers using ACTION_DIAL, however.

Upvotes: 3

Related Questions