driving user engagement with watchos 3

33
WITH WATCHOS 3 DRIVING USER ENGAGEMENT KRISTINA THAI IOS SOFTWARE ENGINEER @KRISTINATHAI

Upload: kristina-thai

Post on 14-Apr-2017

912 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Driving User Engagement with watchOS 3

WITH WATCHOS 3DRIVING USER ENGAGEMENT

KRISTINA THAI IOS SOFTWARE ENGINEER

@KRISTINATHAI

Page 2: Driving User Engagement with watchOS 3

@KRISTINATHAI

USER ENGAGEMENT🙋

📲🙋

🌧🍝🌇

Page 3: Driving User Engagement with watchOS 3

@KRISTINATHAI

💇???💃🏄

USER ENGAGEMENT

Page 4: Driving User Engagement with watchOS 3

@KRISTINATHAI

⌚Background

TasksComplications

Local Notifications

USER ENGAGEMENT

Page 5: Driving User Engagement with watchOS 3

COMPLICATIONS

Page 6: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 7: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 8: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 9: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 10: Driving User Engagement with watchOS 3

@KRISTINATHAI

import ClockKit

class ComplicationController: NSObject, CLKComplicationDataSource { // MARK: - Timeline Configuration func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) { handler([.forward, .backward]) } func getTimelineStartDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) { handler(nil) } func getTimelineEndDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) { handler(nil) } func getPrivacyBehavior(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationPrivacyBehavior) -> Void) { handler(.showOnLockScreen) } // MARK: - Timeline Population func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { // Call the handler with the current timeline entry handler(nil) } func getTimelineEntries(for complication: CLKComplication, before date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) { // Call the handler with the timeline entries prior to the given date handler(nil) } func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) { // Call the handler with the timeline entries after to the given date handler(nil) } // MARK: - Placeholder Templates func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) { // This method will be called once per supported complication, and the results will be cached handler(nil) } }

Page 11: Driving User Engagement with watchOS 3

@KRISTINATHAI

Optional

@KRISTINATHAI

Page 12: Driving User Engagement with watchOS 3

@KRISTINATHAI

import ClockKit

class ComplicationController: NSObject, CLKComplicationDataSource { // MARK: - Timeline Population func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { // Call the handler with the current timeline entry handler(nil) } func getTimelineEntries(for complication: CLKComplication, before date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) { // Call the handler with the timeline entries prior to the given date handler(nil) } func getTimelineEntries(for complication: CLKComplication, after date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) { // Call the handler with the timeline entries after to the given date handler(nil) } }

Page 13: Driving User Engagement with watchOS 3

@KRISTINATHAI

func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {

// Call the handler with the current timeline entry

handler(nil) }

Page 14: Driving User Engagement with watchOS 3

https://theswiftdev.com/2016/04/28/clockkit-complications-cheat-sheet/

CLKComplicationTemplate@KRISTINATHAI

Page 15: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 16: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 17: Driving User Engagement with watchOS 3

@KRISTINATHAI

func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { // Call the handler with the current timeline entry

let template = CLKComplicationTemplateModularLargeStandardBody() template.headerTextProvider = CLKSimpleTextProvider(text: “12:00-2:00PM”) template.body1TextProvider = CLKSimpleTextProvider(text: "Lunch with Lucas") template.body2TextProvider = CLKSimpleTextProvider(text: "Saru Sushi") let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template) handler(timelineEntry) }

Page 18: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 19: Driving User Engagement with watchOS 3

BACKGROUND TASKS

Page 20: Driving User Engagement with watchOS 3

@KRISTINATHAI

Page 21: Driving User Engagement with watchOS 3

@KRISTINATHAI

BACKGROUND TASKSWKApplicationRefreshBackgroundTask⌚

WKSnapshotRefreshBackgroundTask📷

WKWatchConnectivityRefreshBackgroundTask📲

WKURLSessionRefreshBackgroundTask🌐

Page 22: Driving User Engagement with watchOS 3

@KRISTINATHAI

WKApplicationRefreshBackgroundTask⌚

⌚ 🌐⌚NSURLSession

📷⌚Snapshots

Update app from background

Page 23: Driving User Engagement with watchOS 3

@KRISTINATHAI

WKSnapshotRefreshBackgroundTask📷

Make updates to your app’s UISupporting up-to-date snapshots keeps your users informed

Page 24: Driving User Engagement with watchOS 3

@KRISTINATHAI

WKURLSessionRefreshBackgroundTask🌐

🌐⌚Trigger NSURLSession to update app from background

Page 25: Driving User Engagement with watchOS 3

@KRISTINATHAI

WKWatchConnectivityRefreshBackgroundTask📲

📱⌚Get latest data from iPhone via Watch Connectivity

📱⌚Be a good battery/data citizen by pulling data from server only once

🌐

Page 26: Driving User Engagement with watchOS 3

LOCAL NOTIFICATIONS

Page 27: Driving User Engagement with watchOS 3

@KRISTINATHAI

LOCAL NOTIFICATIONSLike push notifications, but scheduled locally

Handled by UNUserNotificationCenter(allows management of duplicates sent to both devices)

Page 28: Driving User Engagement with watchOS 3

@KRISTINATHAI

// Create the content let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil) content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil) content.sound = UNNotificationSound.default()

// Deliver the notification in five seconds. let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false) let request = UNNotificationRequest.init(identifier: "FiveSecond", content: content, trigger:trigger)

// Schedule the notification. let center = UNUserNotificationCenter.current() center.add(request)

Create scheduled local notification

Page 29: Driving User Engagement with watchOS 3

@KRISTINATHAI

LOCAL NOTIFICATIONSUNUserNotificationCenter

Create custom responses for your notifications

Page 30: Driving User Engagement with watchOS 3

@KRISTINATHAI

Respond to custom notification action

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { if response.actionIdentifier == "Complete" { //Handle response here } }

Page 31: Driving User Engagement with watchOS 3

@KRISTINATHAI

BOTTOM LINE

Use these to engage your user without any direct interaction

⌚Background

TasksComplications

Local Notifications

Page 32: Driving User Engagement with watchOS 3

@KRISTINATHAI

RESOURCES

kristina.io/watchos-3-key-takeaways-from-wwdc16

kristina.io/watchos-3-key-takeaways-from-wwdc16-part-2

Page 33: Driving User Engagement with watchOS 3

kristina.io [email protected] @kristinathai

THANK YOU-