我有一个问题,如何在 brodcastreceiver onCallEnded (SIP) 中完成活动。有一个这样的brodcastreceiver:
public class IncomingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SipAudioCall incomingCall = null;
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
...
@Override
public void onCallEnded(SipAudioCall call) {
// IncomingCallActivity.finish();
}
};
Main mainActivity = (Main) context;
incomingCall = mainActivity.manager.takeAudioCall(intent, listener);
mainActivity.call = incomingCall;
Intent i = new Intent(context, IncomingCallActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
然后开始新的活动来接听或拒绝来电,但是通话结束后如何关闭它?IncomingCallActivity.finish()
中不能使用onCallEnded
。