Windows Store app Development Snack: What do you get from being a lock screen app?

When you start with development of Windows Store apps, you may want to run tasks in the background, and an important aspect of that is deciding whether you want to be a lock screen app or not. Microsoft has a guide, which is essential reading—so this post should be seen as a cheat sheet for a portion of that document.


Triggers

Background tasks kick off on a trigger, so what triggers lock screen and non-lock screen apps can use. Non-lock screen apps can run background tasks based on:

Background task trigger typeTrigger eventWhen the background task is triggered
MaintenanceTriggerMaintenanceTriggerIt’s time for maintenance background tasks.
SystemEventTriggerInternetAvailableThe internet becomes available.
SystemEventTriggerLockScreenApplicationAddedAn app tile is added to the lock screen.
SystemEventTriggerLockScreenApplicationRemovedAn app tile is removed from the lock screen.
SystemEventTriggerNetworkStateChangeA network change (e.g., cost or connectivity) occurs.
SystemEventTriggerOnlineIdConnectedStateChangeThe online ID associated with the account changes.
SystemEventTriggerServicingCompleteThe system finishes updating an application.
SystemEventTriggerSessionDisconnectedThe session is disconnected.
SystemEventTriggerSmsReceivedA new SMS message is received by an installed mobile broadband device.
SystemEventTriggerTimeZoneChangeThe time zone changes on the device (e.g., daylight saving time).

Lock screen apps can use those and much more; the extra triggers for lock screen apps are:

Background task trigger typeTrigger eventWhen the background task is triggered
ControlChannelTriggerControlChannelTriggerOn incoming messages on the control channel.
PushNotificationTriggerPushNotificationTriggerA raw notification arrives on the WNS channel.
SystemEventTriggerControlChannelResetA network channel is reset.
SystemEventTriggerSessionDisconnectedThe session is disconnected.
SystemEventTriggerUserAwayThe user becomes absent.
SystemEventTriggerUserPresentThe user becomes present.
TimeTriggerTimeTriggerA time event occurs.

CPU

Now that we know when background tasks will run, how much CPU they can consume during execution depends on whether they’re for lock screen or non-lock screen apps.

Before diving into the table, there are three key things to note:

CPU resource quotaRefresh period
Lock screen app2 CPU seconds15 minutes
Non-lock screen app1 CPU second2 hours

Bandwidth

Like CPU, bandwidth limits depend on whether you’re a lock screen app, but your average internet speed also matters. Unlike CPU, bandwidth uses two buckets:

The table assumes 1 Mb/s (WiFi) or 10 Mb/s (wired), but slower speeds reduce allocations.

Average throughputLock screen appsNon-lock screen apps
Every 15 minPer dayEvery 2 hours
1 Mb/s0.469 Mb4.69 Mb
10 Mb/s4.69 Mb450 Mb

Global Pool

If the dedicated resources aren’t enough, Windows has a shared global pool for CPU/bandwidth. It’s not guaranteed, but you may still get extra (e.g., if you need 2.5 CPU seconds). However, abusive apps can block yours. The pool refreshes every 15 minutes.

To test without the global pool (highly recommended!), disable it via registry:

Value nameTypeDefaultDescription
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BackgroundModel\Policy\CpuEnableGlobalPoolDWORD1Disables CPU global pool if set to 0.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BackgroundModel\Policy\NetEnableGlobalPoolDWORD1Disables network global pool if set to 0.

Control Channel

Taken from Staying connected in the background.

The network trigger feature supports two resource types for push notifications or keep-alive triggers:

  • Hardware slot: Allows background network notifications even in low-power/connected-standby mode.
  • Software slot: Allows background notifications but not in low-power/connected-standby.

Slots are optional for Windows Notification Service (WNS) but required for network triggers.

By default, apps use software slots (triggered when not in connected standby). Hardware slots work in all states (including connected standby), but only devices with connected-standby-capable network hardware support them. Apps can’t use slots in Sleep/Hibernate or when shut down.

Limitations:

  • Max 5 network triggers per app.
  • First 3 lock screen apps get 3 hardware slots each; others are restricted to software slots.