Madhu Avinash
Madhu Avinash

Reputation: 971

What is the difference between UNNotificationServiceExtension and UNNotificationContentExtension

What is the difference between UNNotificationServiceExtension and UNNotificationContentExtension.

What can one do and the other cannot. I've got through doc but couldn't figure out exact differences

Upvotes: 1

Views: 501

Answers (2)

Shourob Datta
Shourob Datta

Reputation: 2082

UNNotificationServiceExtension:

  • It has no user interface, so less control over this. Just limited functionality
  • It has excellent background mode. First, it prepares himself then displays the user.

UNNotificationContentExtension:

  • It has a user interface, You can customize your desired.
  • Its instantly displays. and content download starts after displaying.

Upvotes: 0

Ildar.Z
Ildar.Z

Reputation: 656

First of all they are different objects:

  • UNNotificationServiceExtension - is an class. It's "lets you customize the content of a remote notification before it is delivered to the user". For example, you could use the extension to decrypt an encrypted data block or to download images associated with the notification.
    So you don't change the UI of Notification, but you can modify notification content.
  • UNNotificationContentExtension - is an protocol. "You adopt this protocol in the custom UIViewController subclass that you use to present your interface."
    So you can create custom interface for your notification (ex. for some type of notification) and add your controls.

Upvotes: 2

Related Questions