Push notification with linhpone sdk

161 views Asked by At

I want to enable Push notification for my application in order to "raise" the application from the background during a call (or when it is closed, but this is not so important anymore) and I met this mCore.pushNotificationEnabled property at Core and had questions:

  1. if I do so mCore.pushNotifications Enabled = true then I don't need to write my PushRegistry in AppDelegate ? Is there anything else to add to this?
  2. If you download the linphone-ios project from the sdk creators at this link https://gitlab.linphone.org/BC/public/linhome-ios then you can find by searching for xcode such a function ->
/// Callback prototype for notifying the application a push notification was
/// received. 
/// On iOS it only works with pushkit (VoIP) pushes. 
/// - Parameter core: LinphoneCore object    
/// - Parameter payload: the body of the push notification, if any    
func onPushNotificationReceived(core: Core, payload: String)

but in my project I don't quite understand how to call it, since even xcode doesn't find it by search

  1. If you still can not write your PushRegistry, then what should be the payload for the function from the second point? Does it have to contain registration data or something else along with it?
1

There are 1 answers

2
Viish On BEST ANSWER

if I do so mCore.pushNotifications Enabled = true then I don't need to write my PushRegistry in AppDelegate ?

According to https://wiki.linphone.org/xwiki/wiki/public/view/Lib/Features/Push%20notifications/, indeed you don't need to write your PushRegistry.

func onPushNotificationReceived(core: Core, payload: String)

This is a delegate from the CoreDelegate. That means you can add a delegate on the Core listening for the push in your app.

Maybe you could benefit from the iOS tutorials, especially the one related to push notifications.