I have my own app to integrate Sinch in order to call video. My big bug is when user A calling to user B, user C and all other users also received the notification for incoming call (both applications of user B and C are background).
Here is my code for getting local notification. In the headers
of call
, i pass 3 parameters: remote user id, caller name and caller avatar. I try to print out but it shows nil
. I think the solution is put current user id equal to remote user id but i can not get anything from the headers
, please show me how to fix this.
func client(_ client: SINCallClient!, localNotificationForIncomingCall call: SINCall!) -> SINLocalNotification! {
print("notificationcall \(call?.headers)")
let notification = SINLocalNotification()
notification.alertBody = "Cuộc gọi call video"
notification.soundName = UILocalNotificationDefaultSoundName
return notification
}
In didReceiveIncomingPushWithPayload you need to get the remoteId from header and in handleRemoteNotification check if the localUser is the same of remoteId if is it ! you need you show the notification of video call and if not ignore this notification!