SlideShare a Scribd company logo
1 of 25
Notification Framework
DMI Internal Tech Talk
Sokna Ly
Associate Software Engineer, iOS
Agenda
Notifications Overview
User Notifications Framework
• Registration
• Content
• Trigger
• Management
• Actions
Agenda
Service Extensions
Media Attachments
Notifications User Interface
Overview
Existing API Overview
• Different callbacks for local and remote notifications
Limited control after notifications are scheduled
• Different support across multiple platforms
• Depreciated in iOS 10
User Notifications Framework
• Familiar API
• Expanded content
• Same code path for local and remote notification handling S
• Better notification management
• In-app presentation option
• Schedule and handle notifications in extensions
User Notifications Framework
Registration
User Authorization Options
• Badging
• Sound Alerts
• Banners
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
// Code for handling goes here
}
Needed for both local and remote notifications
User Notifications Framework
Content
Title
Subtitle
Body
Media Attachment
User Notifications Framework
let content = UNMutableNotificationContent()
content.title = “This is title"
content.subtitle = “This is subtitle"
content.body = “I’m body…wahooo!”
content.badge = 1
Local Notification
Remote Notification
{
"aps": {
"alert": {
"title": "This is title",
"subtitle": "This is subtitle",
"body": "I'm body...wahooo!"
},
"badge": 1
}
}
User Notifications Framework
Trigger
Time Interval CalendarLocation Push
Trigger
Time Interval
Example
UNTimeIntervalNotificationTrigger(timeInterval: 60,
repeats: false)
• “In 1 minute from now”
• “Repeat every hour starting now”
UNTimeIntervalNotificationTrigger(timeInterval: 3600,
repeats: false)
Trigger
Calendar
Example
let dateComponents = DateComponents()
// Configure dateComponents
UNCalendarNotificationTrigger(dateMatching: dateComponents,
repeats: false)
• “2:00pm tomorrow for meeting”
• “Repeat every Weekdays at 6:00am for gym”
Trigger
Calendar
Example
let region = CLRegion()
// Configure region
UNLocationNotificationTrigger(region: region,
repeats: false)
• “When leaving home”
• “When arriving in proximity of shopping store”
User Notifications Framework
Management
Add notification request
Update and promote Notifications
Remove Notifications (Pending, Delivered)
User Notifications Framework
Actions
Buttons with customizable title
Background and foreground
Text input
iOS and watchOS
Actions
Registration
let replyAction = UNTextInputNotificationAction(identifier: "reply",
title: "Reply",
options: [],
textInputButtonTitle: "Send",
textInputPlaceholder: "Type message here...")
let seenAction = UNNotificationAction(identifier:"seen",
title:"Mark as Read",
options:[])
let dismissAction = UNNotificationAction(identifier:"dismiss",
title:"Dismiss",
options:[])
let category = UNNotificationCategory(identifier: "chat-event",
actions: [replyAction, seenAction, dismissAction],
minimalActions: [replyAction,dismissAction],
intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])
Actions
Presentation
Local Notification
Remote Notification
let content = UNMutableNotificationContent()
content.categoryIdentifier = "chat-event"
{
"aps": {
"alert": "Someone chat to you.",
"category":"chat-event"
}
}
Service Extension
Basic
• Non UI iOS Extension
• Augment or Replace of content of
Remote Notifications
• End-to-end encryption
• Short execution time
• Add attachments
Service Extension
Old school
Server-side App APNs Device
New school
Server-side App APNs DeviceExtension
Service Extension
Implementation
It’s time for implementation
Media Attachments
Basic
• Local and remote notifications
• Support image, audio, video, gif
• Download in the service extension
• Limited processing time and size
Media Attachment
Implementation
override func didReceive(_ request: UNNotificationRequest,
withContentHandler contentHandler:(UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
let content = (request.content.mutableCopy() as! UNMutableNotificationContent)
// Handle attachment downloading
let url = // file url
let attachment = try? UNNotificationAttachment(identifier: "image",
url: url,
options: nil)
content.attachments = [attachment!]
contentHandler(content)
}
Media Attachment
Push
Local Notification
Remote Notification
let content = UNMutableNotificationContent()
let imagePath = Bundle.main.pathForResource("test", ofType: ".jpg")
let attachment = try? UNNotificationAttachment(identifier: "image",
url: URL(fileURLWithPath: imagePath!),
options: nil)
content.attachments = [attachment!]
{
"aps": {
"alert": "Someone chat to you.",
“mutable-content”:1
},
“attachment-url”:”…”
}
Notification User Interface
• Notification content extension
• Custom views
• No interactions
• Respond to notification actions
Implementation
Thanks

More Related Content

Viewers also liked

Bolts Framework
Bolts FrameworkBolts Framework
Bolts FrameworkSokna Ly
 
Push notifications Зачем и почему?
Push notifications Зачем и почему?Push notifications Зачем и почему?
Push notifications Зачем и почему?Denis Makeychev
 
iOS 10 Rich Push Notifications
iOS 10 Rich Push NotificationsiOS 10 Rich Push Notifications
iOS 10 Rich Push NotificationsinFullMobile
 
Brug - Web push notification
Brug  - Web push notificationBrug  - Web push notification
Brug - Web push notificationOlga Lavrentieva
 
What make Swift Awesome
What make Swift AwesomeWhat make Swift Awesome
What make Swift AwesomeSokna Ly
 
Speech Recognition API
Speech Recognition APISpeech Recognition API
Speech Recognition APISokna Ly
 
Push Notifications
Push NotificationsPush Notifications
Push NotificationsCocoaHeads
 
Algoritma perulangan
Algoritma perulanganAlgoritma perulangan
Algoritma perulanganazkiyaku
 
Web Push Notifications
Web Push NotificationsWeb Push Notifications
Web Push NotificationsUgur Eker
 
3D Video Processing - BBS
3D Video Processing - BBS3D Video Processing - BBS
3D Video Processing - BBSOrcun Ulgen
 
Юрий Василевский — Сервис пуш-сообщений Яндекса
Юрий Василевский — Сервис пуш-сообщений ЯндексаЮрий Василевский — Сервис пуш-сообщений Яндекса
Юрий Василевский — Сервис пуш-сообщений ЯндексаYandex
 
Web Push уведомления - успешные кейсы, проблемы и статистика инструмента
Web Push уведомления - успешные кейсы, проблемы и статистика инструментаWeb Push уведомления - успешные кейсы, проблемы и статистика инструмента
Web Push уведомления - успешные кейсы, проблемы и статистика инструментаUAMASTER Digital Agency
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Sittiphol Phanvilai
 
The Best Mobile App Marketing of 2016
The Best Mobile App Marketing of 2016 The Best Mobile App Marketing of 2016
The Best Mobile App Marketing of 2016 Localytics
 

Viewers also liked (14)

Bolts Framework
Bolts FrameworkBolts Framework
Bolts Framework
 
Push notifications Зачем и почему?
Push notifications Зачем и почему?Push notifications Зачем и почему?
Push notifications Зачем и почему?
 
iOS 10 Rich Push Notifications
iOS 10 Rich Push NotificationsiOS 10 Rich Push Notifications
iOS 10 Rich Push Notifications
 
Brug - Web push notification
Brug  - Web push notificationBrug  - Web push notification
Brug - Web push notification
 
What make Swift Awesome
What make Swift AwesomeWhat make Swift Awesome
What make Swift Awesome
 
Speech Recognition API
Speech Recognition APISpeech Recognition API
Speech Recognition API
 
Push Notifications
Push NotificationsPush Notifications
Push Notifications
 
Algoritma perulangan
Algoritma perulanganAlgoritma perulangan
Algoritma perulangan
 
Web Push Notifications
Web Push NotificationsWeb Push Notifications
Web Push Notifications
 
3D Video Processing - BBS
3D Video Processing - BBS3D Video Processing - BBS
3D Video Processing - BBS
 
Юрий Василевский — Сервис пуш-сообщений Яндекса
Юрий Василевский — Сервис пуш-сообщений ЯндексаЮрий Василевский — Сервис пуш-сообщений Яндекса
Юрий Василевский — Сервис пуш-сообщений Яндекса
 
Web Push уведомления - успешные кейсы, проблемы и статистика инструмента
Web Push уведомления - успешные кейсы, проблемы и статистика инструментаWeb Push уведомления - успешные кейсы, проблемы и статистика инструмента
Web Push уведомления - успешные кейсы, проблемы и статистика инструмента
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]
 
The Best Mobile App Marketing of 2016
The Best Mobile App Marketing of 2016 The Best Mobile App Marketing of 2016
The Best Mobile App Marketing of 2016
 

Similar to Notification Framework

What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...
What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...
What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...将之 小野
 
Bots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsBots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsJenkins NS
 
Cross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha TouchCross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha TouchFolio3 Software
 
Bots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsBots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsJenkins NS
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart JfokusLars Vogel
 
KKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - JeffereyKKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - JeffereyLiyao Chen
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOSjimmyatmedium
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android DevelopersJosiah Renaudin
 
Building apps for microsoft teams - aossg
Building apps for microsoft teams - aossgBuilding apps for microsoft teams - aossg
Building apps for microsoft teams - aossgJenkins NS
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30fiyuer
 
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...Sencha
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2FIWARE
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
MVC In Sencha Touch
MVC In Sencha TouchMVC In Sencha Touch
MVC In Sencha TouchAmith
 
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Patrick Lauke
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchMongoDB
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB
 
Office Dev Day 2018 - Extending Microsoft Teams
Office Dev Day 2018 - Extending Microsoft TeamsOffice Dev Day 2018 - Extending Microsoft Teams
Office Dev Day 2018 - Extending Microsoft TeamsAndré Vala
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationMark Gu
 

Similar to Notification Framework (20)

What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...
What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...
What's New in User Notifications Framework - WWDC16. Meetup @Wantedly with 日本...
 
Bots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsBots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teams
 
Cross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha TouchCross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha Touch
 
Bots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teamsBots, adaptive cards, task module, message extensions in microsoft teams
Bots, adaptive cards, task module, message extensions in microsoft teams
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart Jfokus
 
KKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - JeffereyKKBOX WWDC17 Notification and Autolayout - Jefferey
KKBOX WWDC17 Notification and Autolayout - Jefferey
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
Building apps for microsoft teams - aossg
Building apps for microsoft teams - aossgBuilding apps for microsoft teams - aossg
Building apps for microsoft teams - aossg
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
 
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2
 
2nd--mac ver
2nd--mac ver2nd--mac ver
2nd--mac ver
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
MVC In Sencha Touch
MVC In Sencha TouchMVC In Sencha Touch
MVC In Sencha Touch
 
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
Office Dev Day 2018 - Extending Microsoft Teams
Office Dev Day 2018 - Extending Microsoft TeamsOffice Dev Day 2018 - Extending Microsoft Teams
Office Dev Day 2018 - Extending Microsoft Teams
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 

Notification Framework