Android voice call logging

前端 未结 2 1210
臣服心动
臣服心动 2020-12-30 16:49

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

  • If it was an incoming or outgoing call
相关标签:
2条回答
  • 2020-12-30 17:07

    A PhoneStateListener and the CallLog content provider will give you most, if not all, of what you need.

    0 讨论(0)
  • 2020-12-30 17:20

    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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题