通过android BroadcastReceiver发送呼叫信息

通过android BroadcastReceiver发送呼叫信息,android,phone-call,outgoing-call,Android,Phone Call,Outgoing Call,我想在拨打号码后查找一些事件,即在目的地,呼叫被接受或拒绝,忙或无法接通。如何在android中找到这些事件。我在android.TelephonyManager中找到了一些API,但这些API是用于in_COMMING_调用的。在我拨了号码后,我正在使用广播接收器查找事件。这段代码是 public void onReceive(Context context, Intent intent) { System.out.println("before if condition");

我想在拨打号码后查找一些事件,即在目的地,呼叫被接受或拒绝,忙或无法接通。如何在android中找到这些事件。我在android.TelephonyManager中找到了一些API,但这些API是用于in_COMMING_调用的。在我拨了号码后,我正在使用广播接收器查找事件。这段代码是

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***");
        }       
};
我找不到目标设备上的呼叫已被接受、拒绝或正忙。在android中,是否有任何基于网络的API可以在传出_调用期间查找这些事件?请帮帮我

我还使用了PhoneStateListener,代码是

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);
    }
}
但是我没有接到外线电话上的事件。。 谢谢
shiv

使用或手表进行广播。

使用或手表进行广播。

非常感谢Hovanesyan。我的代码与操作\电话\状态\更改的API配合得很好。@Shiv,我的问题就像你的问题一样,你如何解决,在哪个操作中你在马尼拉注册了你的接收器。非常感谢Hovanesyan。我的代码在操作\u PHONE\u STATE\u CHANGED API中运行良好。@Shiv,我的问题就像你的问题,你如何解决,在哪个操作中你在manifast中注册了你的接收器