I want to find some events after I dialed for a number, i.e at the destination side, the call is accepted or rejected or busy or not-reachable. How to find these events in android. I got found some API's in android.TelephonyManager but those for IN_COMMING_CALL. And I am using BroadcastReceiver() to find events after i dialed for number. the piece of code is,
public void onReceive(Context context, Intent intent) {
System.out.println("before if condition");
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
System.out.println("**outgoingcall***");
}
};
I am unable to find the call is accepted or rejected or busy at destination device. are there any network based API's to find these events during outgoing_call in android? please help me
also I used PhoneStateListener, the code is
private class ListenToPhoneState extends PhoneStateListener {
public void onCallStateChanged(int state, String incomingNumber) {
Log.i("telephony-example", "State changed: " + stateName(state));
}
String stateName(int state) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
System.out.println("phone is idle****");
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
System.out.println("phone is offhook****");
break;
case TelephonyManager.CALL_STATE_RINGING:
System.out.println("phone is Ringing***");
break;
}
return Integer.toString(state);
}
}
But I am not getting the events on Outgoing_call.. Thanks shiv
Use a PhoneStateListener or watch for ACTION_PHONE_STATE_CHANGED broadcast Intents.