I have registered incomingCall broadcast receiver, and it works fine, but I need receiver when the call is established (or rejected). What I actually need is something to notify me when the user press 'Answer' or 'Reject' call.
Asked
Active
Viewed 5,430 times
1 Answers
9
You can override your onReceive method of BroadcastReceiver as below
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
//Phone is ringing
} else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
//Call received
} else if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
//Call Dropped or rejected
}
}
-
Have a look also on http://stackoverflow.com/questions/5486793/ansroid-listen-incoming-calls-through-broadcastreceiver-without-phonestateint – Felipe Dec 05 '11 at 03:29
-
) is missed in line 4 – Menna-Allah Sami Sep 09 '14 at 10:23