Description for using notification service extension

Last updated: 2019-11-13 15:33:15

PDF

iOS Extension SDK API (iOS 10+)

Feature Description

In iOS 10.0+, the operating system provides the Service Extension API, which can be called by the client to listen to the arrival of messages.
Receipt of push message reporting. This API is used to check if push messages reach the devices.
SDK notification delivery access rate API

/**
  @brief    TPNS handles messages that reach the devices                         
  @note    The associated rich media file, you need to set the full URL address of its resources in the push frontend, and the file will be  downloaded automatically in the SDK.        
*/
  - (void)handleNotificationRequest:(nonnull UNNotificationRequest *)request
  appID:(uint32_t)appID contentHandler:(nullable void(^)( NSArray
  <UNNotificationAttachment *>* _Nullable attachments,  NSError * _Nullable
  error))handler;

Parameter Description

request: Push request
appID: The TPNS app ID
handler: Receipt of message processing, the associated rich media file will be processed in callback
Use instructions:
Follow the steps below to use the extension SDK.

  1. In the xcode menu bar, select File>New. Select Target
  2. Select Notification Service Extension and click Next
  3. Enter Product Name and click Finish
  4. Configure Target and add the dependent library files: libXGExtension.a, libz.tbd, libsqlite3.tbd

  1. Call the SDK notification delivery access rate API

Sample

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request
  withContentHandler:(void (^)(UNNotificationContent *
  _Nonnull))contentHandler {
      [[XGExtension defaultManager] handleNotificationRequest:request appID:
  <#your xg AppID#> contentHandler:nil];
      self.contentHandler = contentHandler;
      self.bestAttemptContent = [request.content mutableCopy];
      self.contentHandler(self.bestAttemptContent);
      }