Android的语音通话记录 [英] Android voice call logging

查看:158
本文介绍了Android的语音通话记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一些code是任何传入和传出的语音呼叫通知。我需要抓住所有的以下内容:

I'd like to have some code be notified of any incoming and outgoing voice calls. I need to grab all the following:

  • 如果这是一个拨入或拨出电话
  • 在拨打的号码,或收到的来电显示的电话号码
  • 呼叫的持续时间,或者如果它是一个未接来电

这也将是非常漂亮的,如果我能得到更多的联系方式,具体联系人姓名,如果电话号码匹配起来的人在手机的联系人列表中,但是这部分是可选的。

It would also be really slick if I could get more contact info, specifically the contact name, if the phone number matches up to someone in the phone's contacts list, but that part is optional.

我需要我的code得多,只要一个电话结束获取此信息pretty的。也许我只是没有寻找正确的条款,但我有一个真正的很难找到的我会怎样做到这一点的任何例子。

I need my code to get this information pretty much as soon as a call has ended. Maybe I'm just not searching for the correct terms but I'm having a real hard time finding any examples of how I would accomplish this.

如果有人可以提供完成这个,连同权限和任何形式的安装,我需要在manifest文件的广播接收器类型的code举例来说,将是巨大的。

If someone could provide a code example that accomplishes this, along with the permissions and any sort of broadcast receiver type of setup I would need in the manifest file, that would be great.

推荐答案

您应该能够通过侦听 android.intent.action.NEW_OUTGOING_CALL 来直接观看传出呼叫广播事件,通过设置 android.permission.PROCESS_OUTGOING_CALLS 许可,您的清单。

You should be able to directly watch outgoing calls by listening for android.intent.action.NEW_OUTGOING_CALL broadcast events, by setting the android.permission.PROCESS_OUTGOING_CALLS permission in your manifest.

我想这应该适用于其他设备;至少在我的HTC Hero这给了我一个意图全设施,如电话号码被调用,联系人的姓名加上URI的联系人和个体数被调用。

I imagine this should work for other devices; at least on my HTC Hero this gives me an Intent full of extras including the phone number being called, the contact's name plus URIs for the contact and individual number being called.

至于混得来电或未接来电(实际上拨出电话)的全部信息,我相信马克提到的解决方法是看 CallLog 内容提供商的变化,或调查相关的 PhoneStateListener 事件被解雇后。

As for getting full information on incoming or missed calls (and indeed outgoing calls), I believe the solution as Mark mentions is to watch the CallLog content provider for changes, or poll after the relevant PhoneStateListener events have been fired.

这篇关于Android的语音通话记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆