如何处理来电挂断电话来电来电通知

时间:2016-03-05 16:39:24

标签: android sinch incoming-call

我刚刚开始研究sinch SDK。如果呼叫者在悔改接受来电之前已经挂断电话,我会对如何处理来电感到困惑。现在有方法如何处理这种情况。这是我的代码,我正在处理无法调用

sinchClient.getCallClient().addCallClientListener(new CallClientListener() {
        @Override
        public void onIncomingCall(CallClient callClient, final Call call) {
            mAudioPlayer = new AudioPlayer(HomeActivity.this);
            mAudioPlayer.playRingtone();
            Dialog dialog = new Dialog(HomeActivity.this);
            dialog.setContentView(R.layout.incoming_call_notification);
            dialog.setTitle("Incoming Call");
            TextView callerName = (TextView) dialog.findViewById(R.id.incoming_caller_name);
            CircularImageView callerProfileImage = (CircularImageView) dialog.findViewById(R.id.profile_image_incoming_call);
            Button pickCallBtn = (Button) dialog.findViewById(R.id.incomming_call_pick_up);
            Button hangUpCall = (Button) dialog.findViewById(R.id.incomming_call_hang_up);
            pickCallBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mAudioPlayer.stopRingtone();
                    call.answer();
                }
            });
            hangUpCall.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mAudioPlayer.stopRingtone();
                    if (call!=null){
                        call.hangup();
                    }
                }
            });
        }
    });

提前感谢!!

1 个答案:

答案 0 :(得分:0)

如果在被叫方回答之前呼叫者挂断,您将在应答场景中收到callDidEnd事件。