Is there a way to identify when Accept or Decline button are clicked when a phone call arrives. I am specifically looking for this event. The TelephonyManager.EXTRA_PHONE_STATE does not solve the purpose.
I am not sure but there might be some broadcast receivers for that. Android has broadcast receivers like power button is pressed , ear-phones are p[lugged. Batter is removed etc etc. Same way there has to be something.
Joined: Jun 18, 2003
There is a broadcast receiver for phone state, but I have not found one for accept or decline button. If someone, knows how to do this, please let me know.
Joined: Jan 30, 2010
TelephonyManager has something. Again I am not sure will this work or not.
You can use onCallStateChanged (int state, String incomingNumber) method from android.telephony.PhoneStateListener.
This method gets called when the phone is ringing with state TelephonyManager.CALL_STATE_RINGING and after that it will be called again with TelephonyManager.CALL_STATE_OFFHOOK if the user accepts the call or TelephonyManager.CALL_STATE_IDLE if the call is rejected or not answered.
The same method will be invoked with TelephonyManager.CALL_STATE_OFFHOOK when you place a call but in this case the incomingNumber will be empty.
It is the same thing. Even with onCallStateChanged(), you can't tell when accept or decline button is clicked. For example, you won't be able to distinguish between missed calls and rejected calls for example.
subject: How to identify when Accept Button is clicked.