Presentation is loading. Please wait.

Presentation is loading. Please wait.

intro to notifications in iOS 10

Similar presentations


Presentation on theme: "intro to notifications in iOS 10"— Presentation transcript:

1 intro to notifications in iOS 10
Paola Mata iOS Developer at BuzzFeed Co-founder, NYC Tech Latinas

2 overview

3 user notifications visual alerts - banner, lock screen, notification center sounds/vibration app icon badges By user notification, I am also referring to the sounds and badges as well.

4 types of notifications
local - sent by apps on device remote - push server-side application component Apple Developer membership For remote - server side application component (I used firebase) Apple membership required to support

5 why user notifications?
increase user engagement perform activities in the background (silent) more powerful than ever! To get your users attention when they’re not using your app and redirect them to your app Background tasks provide a better user experience BuzzFeed News example: new alerts and background tasks, downloading cache html for offline use.

6 notifications setup So now, we’re psyched about notifications, right? How do we get them into our applications.

7 steps registration create content triggers schedule
Ranging in order of complexity Content for remote notifications is provided as JSON dictionary

8 registration obtain user authorization for both local & remote
specify authorization options (alert, badge, sound) configurable in settings remote notifications also require token registration* *Will explain in more detail in a bit

9 request authorization
Completion handler if user accepted, register for remote

10 remote notification registration
certificate signing request development APNs create App ID (explicit) configure App ID for push notifications register device(s) create provisioning profile configure project (Xcode) register for push notifications Steps happen in your apple developer account Xcode 8 can generate provisioning profiles for you, but don’t rely on Xcode too heavily.

11 token registration obtained from APNS UIApplication registration
sent to your server-side application included with notification payload Earlier mentioned token registration required for remote notifications Much of this is handled by the app delegate, which conforms to UIApplicaionDelegate

12 content title subtitle body optional media attachments

13 create content

14 triggers time interval calendar location push (remote)
Strong Lifts - timer after each set, notifications every 90, 3 or 5 mins Headspace - daily calendar reminders to meditate Home Depot in-store notifications BuzzFeed News! - push news alerts

15 create a trigger Other trigger classes with respective initializers:
UNLocationNotificationTrigger UNCalendarNotificationTrigger

16 schedule local notifications
create request with identifier, content, and trigger add request on UNUserNotificationCenter

17 create and add request request Identifier will be important later, when we go into updating/replacing notifications.

18 scheduling remote notifications
server side application sends notification payload to APNs notification payload forwarded to device

19 push notification payload
JSON dictionary Other APNS include: content-available and category (custom actions)

20 what’s new in iOS 10?

21 rich notifications Local image add the image as an attachment by providing identifier and url for image We can also add gifs and video

22 3D touch custom actions Added at time of registration:
custom - response handed by delegate method dismiss - requires opt-in via category options* Default notification action opens up the app Custom actions available since iOS 8 Use 3D Touch in iOS 10

23 adding custom actions UNNotitification actions require identifier
Dismiss action need to be added via category options

24 supporting custom actions
For remote, the identifier would be sent with the notification payload

25 handling custom actions

26 notification management
remove delivered notifications and/or pending notification requests handle updates to existing and pending notifications create a new notification add request using request identifier of notification to update

27 service extension Service Extensions are a non-User Interface extension (available in iOS 10) that run in the background with the main purpose of augmenting or replacing the visible content of a remote notification before it is presented to the user.

28 service extension, cont’d
potential uses - end to end encryption, add media attachments short execution time -> fallback method -> shows original notification to launch extension, notification payload should include “mutable-content” key Service Extensions are meant to run quickly and are only given a short amount of time to execute by the system. In the event that the Service Extension fails to complete its task in the allotted amount of time, a fallback method will be called. If the fallback fails, the original Notification Content will be displayed to the user.

29 notification content extension
The Notification Content Extension allows the developer to add their own views to the Notification UI and draw out any content they want. It can also handle custom actions.

30 notification content extension, cont’d
multiple content extensions can be used includes: view controller, storyboard, Info.plist creating custom UI default notification content can be hidden interactive UI elements not supported can update UI on custom action can access built-in text input action Info.plist - extension configuration button/text fields not supported Try notifications for messages and calendar notifications for examples Multiple extensions - respond to category identifier

31 resources Apple Documentation on Notifications
WWDC 2016 Sessions 707 & 708 on User Notifications try! Swift NYC talk by Ellen Shapiro (great sample code)

32 Thank you!

33 www.paolamata.com www.madebylatinas.com Twitter: @PaolaNotPaolo


Download ppt "intro to notifications in iOS 10"

Similar presentations


Ads by Google