我正在为我的 Voip 应用程序使用 Csipsimple。当我单击注销按钮时,登录屏幕出现,但是当我在此号码上注销后呼叫时,来电即将到来并且呼叫已连接。
fun disconnect(quit: Boolean, ctx: Context?) {
try {
val intent = Intent(SipManager.ACTION_OUTGOING_UNREGISTER)
intent.putExtra(SipManager.EXTRA_OUTGOING_ACTIVITY, ComponentName(ctx, MainActivity::class.java))
ctx!!.sendBroadcast(intent)
val pref = PrefManager(ctx)
pref.setLoggedIn(false)
val crMain = ChattingClass()
crMain.logoutFromChat(this)
if (quit) {
// also delete the shared preference when disconnect
deleteUserFromPref(ctx)
val finish = Intent(ctx, LoginMainActivity::class.java)
finish.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
finish.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
(ctx as Activity).startActivity(finish)
(ctx as Activity).finish()
}
} catch (e: Exception) {
e.printStackTrace()
}
}
我在单击注销按钮时调用此断开连接方法。我正在注销 sip 连接并清除共享首选项。