简体   繁体   English

在Android中的Samsung Devices中以编程方式拨打电话

[英]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. 使用Nexus 5即可启动通话,但当我在三星设备上尝试使用相同的代码时,它无法执行任何操作。

What is the difference between Nexus 5 and Samsung Devices? Nexus 5和Samsung Devices有什么区别?

Thanks! 谢谢!

[EDITED] [EDITED]

Try using Action.PHONE_DIAL instead. 请尝试使用Action.PHONE_DIAL (In your code, replace ACTION_CALL with ACTION_DIAL ). (在您的代码中,将ACTION_CALL替换为ACTION_DIAL )。

Action.PHONE_CALL is not guaranteed to work for all apps. Action.PHONE_CALL不保证适用于所有应用。 Quoting from the Javadoc: 引用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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM