AWSPinpointNotificationManager

Objective-C

@interface AWSPinpointNotificationManager : NSObject

typedef NS_ENUM(NSInteger, AWSPinpointPushActionType) {
    AWSPinpointPushActionTypeOpened,
    AWSPinpointPushActionTypeReceivedForeground,
    AWSPinpointPushActionTypeReceivedBackground,
    AWSPinpointPushActionTypeUnknown
};

typedef NS_ENUM(NSInteger, AWSPinpointPushEventSourceType) {
    AWSPinpointPushEventSourceTypeCampaign,
    AWSPinpointPushEventSourceTypeJourney,
    AWSPinpointPushEventSourceTypeUnknown
};

#pragma mark - Notification Helpers
/**
 Returns a Boolean indicating whether the app is currently registered for remote notifications.
 @return BOOL YES if the app is registered for remote notifications and received its device token or NO if registration has not occurred, has failed, or has been denied by the user.
 */
+ (BOOL)isNotificationEnabled;

#pragma mark - Interceptors
/**
 Intercepts the `- application:didFinishLaunchingWithOptions:` application delegate.
 
 Targeting must intercept this callback in order to report campaign analytics correctly.
 
 @param launchOptions A dictionary indicating the reason the app was launched (if any). The contents of this dictionary may be empty in situations where the user launched the app directly. For information about the possible keys in this dictionary and how to handle them.
 */
- (BOOL)interceptDidFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;

/**
 Intercepts the `- application:didRegisterForRemoteNotificationsWithDeviceToken:` application delegate.
 
 Targeting must intercept this callback in order to report campaign analytics correctly.
 
 @param deviceToken A token that identifies the device to APNs.
 */
- (void)interceptDidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;

/**
 Intercepts the `- application:didReceiveRemoteNotification:fetchCompletionHandler:` application delegate.
 
 Targeting must intercept this callback in order to report campaign analytics correctly.
 
 @param userInfo    A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an `NSDictionary` object; the dictionary may contain only property-list objects plus `NSNull`.
 @param handler     The block to execute when the download operation is complete. When calling this block, pass in the fetch result value that best describes the results of your download operation. You must call this handler and should do so as soon as possible. For a list of possible values, see the UIBackgroundFetchResult type.
 */
- (void)interceptDidReceiveRemoteNotification:(NSDictionary *)userInfo
                       fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler;

/**
 Intercepts the `- application:didReceiveRemoteNotification:fetchCompletionHandler:shouldHandleNotificationDeepLink:` application delegate.

 Targeting must intercept this callback in order to report campaign analytics correctly. Optionally specify 'shouldHandleNotificationDeepLink' to control whether or not the notification manager should attempt to open the remote notification deeplink, if present.

 @param userInfo        A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an `NSDictionary` object; the dictionary may contain only property-list objects plus `NSNull`.
 @param handler         The block to execute when the download operation is complete. When calling this block, pass in the fetch result value that best describes the results of your download operation. You must call this handler and should do so as soon as possible. For a list of possible values, see the UIBackgroundFetchResult type.
 @param handleDeepLink  Whether or not notification manager should attempt to open the remote notification deeplink, if present
 */
- (void)interceptDidReceiveRemoteNotification:(NSDictionary *)userInfo
                       fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
             shouldHandleNotificationDeepLink:(BOOL) handleDeepLink;

@end

Swift

class AWSPinpointNotificationManager : NSObject

Undocumented

Notification Helpers

  • Returns a Boolean indicating whether the app is currently registered for remote notifications.

    Declaration

    Objective-C

    + (BOOL)isNotificationEnabled;

    Swift

    class func isNotificationEnabled() -> Bool

    Return Value

    BOOL YES if the app is registered for remote notifications and received its device token or NO if registration has not occurred, has failed, or has been denied by the user.

Interceptors

  • Intercepts the - application:didFinishLaunchingWithOptions: application delegate.

    Targeting must intercept this callback in order to report campaign analytics correctly.

    Declaration

    Objective-C

    - (BOOL)interceptDidFinishLaunchingWithOptions:
        (nullable NSDictionary *)launchOptions;

    Swift

    func interceptDidFinishLaunching(options launchOptions: [AnyHashable : Any]? = nil) -> Bool

    Parameters

    launchOptions

    A dictionary indicating the reason the app was launched (if any). The contents of this dictionary may be empty in situations where the user launched the app directly. For information about the possible keys in this dictionary and how to handle them.

  • Intercepts the - application:didRegisterForRemoteNotificationsWithDeviceToken: application delegate.

    Targeting must intercept this callback in order to report campaign analytics correctly.

    Declaration

    Objective-C

    - (void)interceptDidRegisterForRemoteNotificationsWithDeviceToken:
        (nonnull NSData *)deviceToken;

    Swift

    func interceptDidRegisterForRemoteNotifications(withDeviceToken deviceToken: Data)

    Parameters

    deviceToken

    A token that identifies the device to APNs.

  • Intercepts the - application:didReceiveRemoteNotification:fetchCompletionHandler: application delegate.

    Targeting must intercept this callback in order to report campaign analytics correctly.

    Declaration

    Objective-C

    - (void)interceptDidReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
                           fetchCompletionHandler:
                               (nonnull void (^)(UIBackgroundFetchResult))handler;

    Swift

    func interceptDidReceiveRemoteNotification(_ userInfo: [AnyHashable : Any], fetchCompletionHandler handler: @escaping (UIBackgroundFetchResult) -> Void)

    Parameters

    userInfo

    A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.

    handler

    The block to execute when the download operation is complete. When calling this block, pass in the fetch result value that best describes the results of your download operation. You must call this handler and should do so as soon as possible. For a list of possible values, see the UIBackgroundFetchResult type.

  • Intercepts the - application:didReceiveRemoteNotification:fetchCompletionHandler:shouldHandleNotificationDeepLink: application delegate.

    Targeting must intercept this callback in order to report campaign analytics correctly. Optionally specify ‘shouldHandleNotificationDeepLink’ to control whether or not the notification manager should attempt to open the remote notification deeplink, if present.

    Declaration

    Objective-C

    - (void)interceptDidReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
                           fetchCompletionHandler:
                               (nonnull void (^)(UIBackgroundFetchResult))handler
                 shouldHandleNotificationDeepLink:(BOOL)handleDeepLink;

    Swift

    func interceptDidReceiveRemoteNotification(_ userInfo: [AnyHashable : Any], fetchCompletionHandler handler: @escaping (UIBackgroundFetchResult) -> Void, shouldHandleNotificationDeepLink handleDeepLink: Bool)

    Parameters

    userInfo

    A dictionary that contains information related to the remote notification, potentially including a badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.

    handler

    The block to execute when the download operation is complete. When calling this block, pass in the fetch result value that best describes the results of your download operation. You must call this handler and should do so as soon as possible. For a list of possible values, see the UIBackgroundFetchResult type.

    handleDeepLink

    Whether or not notification manager should attempt to open the remote notification deeplink, if present