Is there a way to add a “name” to an ACTION_CALL i

2019-03-03 12:58发布

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.

2条回答
唯我独甜
2楼-- · 2019-03-03 13:41

Since the android specification is not mentioning a name parameter on this intent I'd discouarge using it. DOC HERE

Documentation also mentions that most apps should ACTION_DIAL, as ACTION_CALL might have some restrictions on which apps can call it...

查看更多
走好不送
3楼-- · 2019-03-03 14:00

Sorry if this answer isn't helpful but:

It's the Phone application which catches the "ACTION_CALL" intent Action. Since this is a device specific app it may vary.

Having a quick google I can't find any information either on what extra's it accepts but I would imagine that injecting a "name" could be considered a security vulnerability and therefore wouldn't be part of the app (however I'm not sure).

Giving your app permissions and functionality to add a contact however (and therefore associating a name with a number) is entirely possible and there are many examples out there on how to interface with the Contacts ContentProvider.

查看更多
登录 后发表回答