CS5530 Mobile/Wireless Systems Apple Watch Yanyan Zhuang - - PowerPoint PPT Presentation

cs5530 mobile wireless systems apple watch
SMART_READER_LITE
LIVE PREVIEW

CS5530 Mobile/Wireless Systems Apple Watch Yanyan Zhuang - - PowerPoint PPT Presentation

CS5530 Mobile/Wireless Systems Apple Watch Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang UC. Colorado Springs CS5530 Ref. CN5E, NT@UW, WUSTL cat announce.txt_ Direct device related questions to me


slide-1
SLIDE 1
  • Ref. CN5E, NT@UW, WUSTL

CS5530

CS5530 Mobile/Wireless Systems Apple Watch

Yanyan Zhuang

Department of Computer Science http://www.cs.uccs.edu/~yzhuang

  • UC. Colorado Springs
slide-2
SLIDE 2

cat announce.txt_

  • Ref. CN5E, NT@UW, WUSTL

2 CS5530

  • Direct device related questions to me
  • Midterm date?
  • 3 more people need to vote!
  • Current: March 15: 20%, March 20: 60%, March 22: 20%
slide-3
SLIDE 3

Overview

  • Ref. CN5E, NT@UW, WUSTL

3 CS5530

  • Apple watch
slide-4
SLIDE 4

Apple Watch App

  • Ref. CN5E, NT@UW, WUSTL

4 CS5530

  • Apple Watch app consist of two bundles
  • Watch app bundle
  • Storyboards and resource files associated with app’s user

interfaces

  • WatchKit extension bundle
  • Lives inside Watch app bundle
  • Contains code for managing interfaces for responding to

user interactions

slide-5
SLIDE 5

Apple Watch App

  • Ref. CN5E, NT@UW, WUSTL

5 CS5530

  • Watch app also provide custom notification &

complication interfaces (optional but unique)

  • Code for managing notification and complication interfaces

in WatchKit extension

  • Storyboard scenes are part of main storyboard in Watch app

bundle

slide-6
SLIDE 6

Complications

  • Ref. CN5E, NT@UW, WUSTL

6 CS5530

  • Complications: small visual elements on watch

face that communicate important info to user

  • Complications let you show important information in a

frequently viewed location, making app more visible to user

  • When complication is on watch face

} App stays in memory, which reduces time to launch app } App receives more time to execute background tasks

slide-7
SLIDE 7

Complications

  • Ref. CN5E, NT@UW, WUSTL

7 CS5530

  • Pokémon Go
slide-8
SLIDE 8

Notifications

  • Ref. CN5E, NT@UW, WUSTL

8 CS5530

If your iPhone is unlocked, you'll get notifications

  • n your iPhone, instead of your Apple Watch.

If your iPhone is locked or asleep, you'll get notifications on your Apple Watch, unless your Apple Watch is locked with your passcode.

slide-9
SLIDE 9

Notifications

  • Ref. CN5E, NT@UW, WUSTL

9 CS5530

  • When a notification first arrives
  • Apple Watch displays a short look: a glanceable version of the

notification content

  • If the user’s wrist remains raised, interface changes to a more

detailed long look

  • Developers customize long look to incorporate

custom graphics, dynamic content, etc.

  • User Notifications framework to schedule and

handle notifications from WatchKit extension

  • Supports time-based and location-based local notifications
slide-10
SLIDE 10

Configuring Your Xcode

  • Ref. CN5E, NT@UW, WUSTL

10 CS5530

  • Distribute Watch app inside corresponding iOS

app

  • Can add a Watch app to an existing iOS project, or create a

new iOS project that includes a Watch app

  • Bundles are delivered as part of iOS app on the

App Store

  • Simulator supports running Watch app side-

by-side with iOS app

slide-11
SLIDE 11

Configuring Your Xcode

  • Ref. CN5E, NT@UW, WUSTL

11 CS5530

  • To add a Watch app to existing iOS app project
  • In Xcode, open the project for your iOS app
  • File > New > Target, navigate to watchOS, select WatchKit

App

  • To create a new Watch app project
  • In Xcode, select File > New > Project
  • Navigate to the watchOS section
  • Select iOS App with WatchKit App
slide-12
SLIDE 12

App Target Structure

  • Ref. CN5E, NT@UW, WUSTL

12 CS5530

  • Building iOS app builds all 3 executables and

packages them together in iOS app’s bundle

  • iOS app, Watch app, and WatchKit extension
  • iOS app contains Watch app, which contains WatchKit

extension

  • Communication between WatchKit extension and iOS app is

through the Watch Connectivity framework

slide-13
SLIDE 13

App Target Structure

  • Ref. CN5E, NT@UW, WUSTL

13 CS5530

slide-14
SLIDE 14

Extension Delegate

  • Ref. CN5E, NT@UW, WUSTL

14 CS5530

  • WatchKit extension has a WKExtension object

and a corresponding delegate object to manage app behavior

  • WKExtension object: a shared object available when the

system displays main Watch interface or custom notification interfaces

  • An associated delegate object that conforms to

the WKExtensionDelegate protocol

slide-15
SLIDE 15

Managing the Watch App Life Cycle

  • Ref. CN5E, NT@UW, WUSTL

15 CS5530

  • WatchKit extension notifies extension delegate

at various points

  • Use notifications to implement life cycle behaviors
  • State transitions and methods
  • f WKExtensionDelegate protocol called
slide-16
SLIDE 16

Managing the Watch App Life Cycle

  • Ref. CN5E, NT@UW, WUSTL

16 CS5530

  • A. applicationDidFinishLaunching called
  • B. applicationDidBecomeActive or applicationWillResignActive called
  • C. applicationWillEnterForeground or applicationDidEnterBackground

called

slide-17
SLIDE 17

Simulator

  • Ref. CN5E, NT@UW, WUSTL

17 CS5530

  • During testing, you can lock and unlock the

simulator to verify that your activation and deactivation code is working as expected

  • Hardware -> Lock to lock the simulator
  • This simulates the screen turning off after the user lowers

the wrist