i m facing issue in one to one video call, i am using deauthenticate function and unregister VOIP tokens on logout in my application, and when i try to call that deauthenticated user i am still receiving VOIP notification.
Hi @Ian ,
i m implementing it in iOS, i am using VOIP notifications and unregistering VOIP Push tokens on logout, still i have to use SendBirdCall.unregisterRemotePush ?
func deauthenticate() {
print("deauthenticate appdelegate")
SendBirdCall.deauthenticate { (error) in
guard error == nil else { return }
if let dataToken = UserDefaults.standard.voipPushToken as? Data {
SendBirdCall.unregisterVoIPPush(token: UserDefaults.standard.voipPushToken, completionHandler: nil)
}
else {
SendBirdCall.unregisterVoIPPush(token: tokenVoip, completionHandler: nil)
}
print("Successfully deauthenticated from SendBirdCalls")
}
}
Hi @Android_MR_Firebase , Sorry for the late response.
You should call SendBirdCall.unregisterVoIPPush
before you call SendBirdCall.deauthenticate
. Can you try this and see if the VoIP Push stops?
Hi @mininny
i tried the above, it fixed the issue, now i am not getting any VoIP push after logout, but i am getting another issue when i followed the above, When i logged in again now i am not getting any VoIP notification.
Here is the code snippet for both login(Authenticate) and logout(Deauthenticate)
For Login
//MARK: - Authenticate the user
func authenticate(callerUserId: String) {
let authenticateParams = AuthenticateParams(userId: callerUserId)
SendBirdCall.authenticate(with: authenticateParams) { (user, error) in
guard let user = user, error == nil else { return }
SendBirdCall.registerVoIPPush(token: tokenVoip, unique: true) { error in
guard error == nil else { return }
}
print("Successfully authenticated with userId: \(user.userId)")
}
}
For Logout
//MARK: - Deauthenticate User
func deauthenticate() {
if let dataToken = UserDefaults.standard.voipPushToken as? Data {
SendBirdCall.unregisterVoIPPush(token: UserDefaults.standard.voipPushToken,
completionHandler: nil)
}
else {
SendBirdCall.unregisterVoIPPush(token: tokenVoip, completionHandler: nil)
}
SendBirdCall.deauthenticate { (error) in
guard error == nil else { return }
print("Successfully deauthenticated from SendBirdCalls")
}
}
try with below method
func deauthenticate() {
if let dataToken = UserDefaults.standard.voipPushToken as? Data {
SendBirdCall.unregisterVoIPPush(token: UserDefaults.standard.voipPushToken) { error in
SendBirdCall.deauthenticate { (error) in
guard error == nil else { return }
print(“Successfully deauthenticated from SendBirdCalls”)
}
}
}
else {
SendBirdCall.unregisterVoIPPush(token: tokenVoip) { error in
SendBirdCall.deauthenticate { (error) in
guard error == nil else { return }
print(“Successfully deauthenticated from SendBirdCalls”)
}
}
}
}
after logout check Sendbird Dashboard user token is remove or not and after again login and check register new token