35
background > foreground in Universal Windows Apps on Windows 10 Mike Taulty Microsoft UK @mtaulty

background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

background > foreground in Universal Windows Apps on Windows 10

Mike Taulty Microsoft UK @mtaulty

Page 2: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 3: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

your app spends most of its time here

Page 4: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo

Page 5: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 6: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

rich & timely information

many apps

minimum fuss

low bandwidth

all day battery life

Page 7: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 8: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 9: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

use standard system services

and/or

register custom background tasks

Page 10: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 11: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

extended execution

notifications

background transfers

standard system services

Page 12: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

standard system services

extended execution

notifications

background transfers

Page 13: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

extended execution

Page 14: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo

Page 15: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

standard system services

extended execution

notifications

background transfers

Page 16: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 17: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 18: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo

Page 19: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

standard system services

extended execution

notifications

background transfers

Page 20: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

use the BackgroundDownloader/Uploader HTTP(S)/FTP for download, HTTP(S) for upload, uses network cost policy, reports progress, failure, etc.

transfers continue when suspended (based on policy)

multiple transfers can be grouped for easier management

success/failure -> automatic tile/toast notifications

app should check transfers at startup time

background transfers

Page 21: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo

Page 22: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 23: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

background tasks are custom WinRT components

implement IBackgroundTask

run in the app’s security context

can be many per app

can be sync/async, can report progress and can be cancelled

tasks run when triggers fire & conditions are met

register via BackgroundTaskBuilder & app manifest

background tasks

Page 24: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo

Page 25: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

triggers W

ind

ow

s 8.1

SystemTrigger

TimeTrigger

MaintenanceTrigger

DeviceUseTrigger

DeviceServicingTrigger

PushNotificationTrigger

Pho

ne 8

.1 CachedFileUpdaterTrigger

DeviceConnectionChangeTrigger

GattCharacteristicNotificationTrigger

RfcommConnectionTrigger

LocationTrigger

Win

do

ws 1

0

AppointmentStoreNotificationTrigger

ContactStoreNotificationTrigger

EmailStoreNotificationTrigger

BluetoothLEAdvertisementWatcherTrigger

BluetoothLEAdvertisementPublisherTrigger

DeviceWatcherTrigger

ActivitySensorTrigger

SensorDataThresholdTrigger

ToastNotificationHistoryChangedTrigger

ToastNotificationActionTrigger

ApplicationTrigger

MediaProcessingTrigger

SocketActivityTrigger

Page 26: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

conditions

Page 27: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demos push, transfers, action center, sockets

Page 28: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

app services

Page 29: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

demo app services + Cortana

Page 30: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 31: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

wall clock time: limited to 25s + 5s

memory: variable limit by device (min 16MB)

network: variable limit by device

also: quiet hours, battery saver can limit background tasks

NB: each time a trigger fires, the quotas get reset

background task constraints

Page 32: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

background task constraints

Cancel (5 seconds)

Mem

ory

Run (25 seconds)

Default tasks

Mem

ory

Run (no end)

End (no warning, for now)

Long-running tasks

Page 33: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit
Page 34: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit

keep your app alive with notifications

“every” app will have some background tasks

understand triggers/conditions for your app

Page 35: background > foregrounddownload.microsoft.com/download/D/C/0/DC06C8FF-ADA5-429D-84… · demo app services + Cortana . wall clock time: limited to 25s + 5s memory: variable limit