3

I want to specifically know who ended the call. I have setup a broadcast receiver for

"android.intent.action.PHONE_STATE"

When I detect a transition from Off hook to idle, I know the call has ended. But how do I know who ended the call?

Thanks a ton!

Banned dude
  • 35
  • 1
  • 8

1 Answers1

0

I'm afraid there's presently no way to determine if the user pressed "end call" or if the other end (or ends, in a group call) terminated. The only workaround I can suggest is monitoring the other states to observe if the phone state ringing was encountered. In such a case, you could assume the user is making the phone call as opposed to receiving it.

Bear in mind that there are other problems related to PHONE_STATE, such as handling multiple calls simultaneously.

In retrospect, I'm not entirely sure what you mean with "who". As for other apps ending the call: there is no official API to end phone calls; only through reflection can an app invoke the TelephonyService's endCall() function. Here, too, it is not possible to determine if the call was terminated through user interaction or not.

Community
  • 1
  • 1
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187