YMPYandexMetricaPush class

The main class for push notifications handling.

Instance methods

+handleApplicationDidFinishLaunchingWithOptions:

Handles push notification openings from the method application (_: didFinishLaunchingWithOptions:). Method should be invoked after initialization AppMetrica SDK.

+handleDidReceiveNotificationRequest:

Handles push notifications receiving from Notification Service Extension.

+handleRemoteNotification:

Handles push notification openings from the method application(_:didReceiveRemoteNotification:fetchCompletionHandler:) Method should be invoked after initialization AppMetrica SDK.

+isNotificationRelatedToSDK:

Returns YES if a push notification is related to AppMetrica.

+setDeviceTokenFromData:

Registers the device token for an application with a production environment. Method should be invoked after initialization AppMetrica SDK.

+setDeviceTokenFromData:pushEnvironment:

Registers the device token of the application with the specified environment. Method should be invoked after initialization AppMetrica SDK.

+setExtensionAppGroup:

Registers the App Groups shared group for the app and Notification Service Extension.

+userDataForNotification:
Returns an arbitrary data string that is passed in the push notification:
  • In the Additional data field when sending from the AppMetrica interface.
  • In the data field when sending using the Push API.
+userNotificationCenterDelegate:

Returns a delegate YMPUserNotificationCenterDelegate, which handles foreground push notifications on iOS 10 and higher.

+userNotificationCenterHandler:

Returns a delegate YMPUserNotificationCenterHandling, which allows you to manually handle foreground push notifications on iOS 10 and higher.

+handleApplicationDidFinishLaunchingWithOptions:

Handles push notification openings from the method application (_: didFinishLaunchingWithOptions:). Method should be invoked after initialization AppMetrica SDK.

+handleDidReceiveNotificationRequest:

Handles push notifications receiving from Notification Service Extension.

+handleRemoteNotification:

Handles push notification openings from the method application(_:didReceiveRemoteNotification:fetchCompletionHandler:) Method should be invoked after initialization AppMetrica SDK.

+isNotificationRelatedToSDK:

Returns YES if a push notification is related to AppMetrica.

+setDeviceTokenFromData:

Registers the device token for an application with a production environment. Method should be invoked after initialization AppMetrica SDK.

+setDeviceTokenFromData:pushEnvironment:

Registers the device token of the application with the specified environment. Method should be invoked after initialization AppMetrica SDK.

+setExtensionAppGroup:

Registers the App Groups shared group for the app and Notification Service Extension.

+userDataForNotification:
Returns an arbitrary data string that is passed in the push notification:
  • In the Additional data field when sending from the AppMetrica interface.
  • In the data field when sending using the Push API.
+userNotificationCenterDelegate:

Returns a delegate YMPUserNotificationCenterDelegate, which handles foreground push notifications on iOS 10 and higher.

+userNotificationCenterHandler:

Returns a delegate YMPUserNotificationCenterHandling, which allows you to manually handle foreground push notifications on iOS 10 and higher.

Method descriptions

handleApplicationDidFinishLaunching(withOptions:)

class func handleApplicationDidFinishLaunching(withOptions launchOptions: [AnyHashable : Any]?)

Handles push notification openings from the method application (_: didFinishLaunchingWithOptions:). Method should be invoked after initialization AppMetrica SDK.

Parameters:
launchOptions

Parameters as key-value pairs that contain information about the application start.

launchOptions

Parameters as key-value pairs that contain information about the application start.

handleDidReceive(_:)

class func handleDidReceive(_ request: UNNotificationRequest?)

Handles push notifications receiving from Notification Service Extension.

You should call the method in the implementation of didReceive (_: withContentHandler:).

Parameters:
request

The instance of UNNotificationRequest.

request

The instance of UNNotificationRequest.

handleRemoteNotification(_:)

class func handleRemoteNotification(_ userInfo: [AnyHashable : Any]?)

Handles push notification openings from the method application(_:didReceiveRemoteNotification:fetchCompletionHandler:) Method should be invoked after initialization AppMetrica SDK.

Parameters:
userInfo

Parameters of push notifications as key-value pairs that are transmitted by the system.

userInfo

Parameters of push notifications as key-value pairs that are transmitted by the system.

isNotificationRelated(toSDK:)

class func isNotificationRelated(toSDK userInfo: [AnyHashable : Any]?) -> Bool

Returns YES if a push notification is related to AppMetrica.

Parameters:
userInfo