0

Here's a code snippet of what I have:

 call_phone = new Intent(Intent.ACTION_CALL);
 call_phone.setData(Uri.parse(parameter)); // parameter is a phone number tel:someNumber
 con.startActivity(call_phone);

Since the phone number is not listed in my actual contacts - I just wanted to know if there was a way to pass a putExtra or a setName or something along those lines - that would let me make the dialer display any name I want to call - along with the number?

I have looked around on stack overflow and on the android developer website - but can't find anything specific like setting the name, setting the number is all over the place.

4

2 回答 2

1

抱歉,如果此答案没有帮助,但是:

捕获"ACTION_CALL"意图的是电话应用程序Action。由于这是一个特定于设备的应用程序,因此可能会有所不同。

快速谷歌我找不到任何关于它接受什么额外的信息,但我想注入“名称”可能被认为是一个安全漏洞,因此不会成为应用程序的一部分(但我不确定)。

但是,为您的应用程序授予添加联系人的权限和功能(因此将名称与数字相关联)是完全可能的,并且有很多关于如何与联系人交互的示例ContentProvider

于 2012-11-09T15:43:37.190 回答
1

由于android规范没有提到这个意图的名称参数,我不鼓励使用它。医生在这里

文档还提到大多数应用程序应该 ACTION_DIAL,因为 ACTION_CALL 可能对哪些应用程序可以调用它有一些限制......

于 2012-11-09T15:49:22.233 回答