2

My android app makes outgoing call:

        Intent dial = new Intent(Intent.ACTION_CALL, Uri.parse("tel:12345678900));
        startActivity(dial);

After that user (caller) or callee can hang up. How can I detect who hung up caller or callee? I've seen the same question but there are not a positive answer, only negative and it was 4 years ago.

I can't believe that it's impossible. I tried to use BroadcastReceiver, PhoneStateListener, CallLog. It's helped to detect type of call: outgoing or incoming call, answered or unanswered call but it hasn't helped to detect who hung up caller or callee.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

It's pretty easy you need to have a broadcast receiver which listens for an intent call hangup or in technical terms TELEPHONYMANAGER.EXTRA_STATE_OFHOOK

If required you can also check if the number was the number you dialed to. If you require any additional code etc. Comment below and I'll help.

KISHORE_ZE
  • 1,466
  • 3
  • 16
  • 26
  • As I know that Broadcast receiver can only help to detect when the call began and ended but it can't help to detect who hung up caller or callee. May be I don't know something. If so clarify me please with some example. – Andrey Hitrikov Aug 22 '15 at 21:08