0
我剛剛開始研究sinch SDK。而且,如果在悔改接受來電之前呼叫者已經掛斷了呼叫,我很困惑如何處理來電。現在有方法處理這種情況。這裏是我的代碼,我正在處理imimg電話如何處理傳入呼叫通知的中斷掛斷呼叫
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();
}
}
});
}
});
在此先感謝!
這個方法是CallListener的一部分嗎? –
是的,https://download.sinch.com/docs/android/latest/reference/index.html?com/sinch/android/rtc/SinchClient.html它的名爲onCallEnded – cjensen