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 type | Trigger event | When the background task is triggered |
|---|---|---|
MaintenanceTrigger | MaintenanceTrigger | It’s time for maintenance background tasks. |
SystemEventTrigger | InternetAvailable | The internet becomes available. |
SystemEventTrigger | LockScreenApplicationAdded | An app tile is added to the lock screen. |
SystemEventTrigger | LockScreenApplicationRemoved | An app tile is removed from the lock screen. |
SystemEventTrigger | NetworkStateChange | A network change (e.g., cost or connectivity) occurs. |
SystemEventTrigger | OnlineIdConnectedStateChange | The online ID associated with the account changes. |
SystemEventTrigger | ServicingComplete | The system finishes updating an application. |
SystemEventTrigger | SessionDisconnected | The session is disconnected. |
SystemEventTrigger | SmsReceived | A new SMS message is received by an installed mobile broadband device. |
SystemEventTrigger | TimeZoneChange | The 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 type | Trigger event | When the background task is triggered |
|---|---|---|
ControlChannelTrigger | ControlChannelTrigger | On incoming messages on the control channel. |
PushNotificationTrigger | PushNotificationTrigger | A raw notification arrives on the WNS channel. |
SystemEventTrigger | ControlChannelReset | A network channel is reset. |
SystemEventTrigger | SessionDisconnected | The session is disconnected. |
SystemEventTrigger | UserAway | The user becomes absent. |
SystemEventTrigger | UserPresent | The user becomes present. |
TimeTrigger | TimeTrigger | A 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:
- This applies per app, not per background task.
- The refresh period determines when resources reset. Multiple background tasks share the pool, and unused time is lost at refresh.
- A CPU second ≠ a real second; CPU time is only counted when the CPU is actively working (e.g., I/O like downloads doesn’t count).
| CPU resource quota | Refresh period | |
|---|---|---|
| Lock screen app | 2 CPU seconds | 15 minutes |
| Non-lock screen app | 1 CPU second | 2 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:
- Short-term (every 15 min/day): Smaller, frequent allocation.
- Daily cap: Accumulated limit (smaller periods cannot exceed this).
The table assumes 1 Mb/s (WiFi) or 10 Mb/s (wired), but slower speeds reduce allocations.
| Average throughput | Lock screen apps | Non-lock screen apps |
|---|---|---|
| Every 15 min | Per day | Every 2 hours |
| 1 Mb/s | 0.469 Mb | 4.69 Mb |
| 10 Mb/s | 4.69 Mb | 450 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 name | Type | Default | Description |
|---|---|---|---|
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BackgroundModel\Policy\CpuEnableGlobalPool | DWORD | 1 | Disables CPU global pool if set to 0. |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BackgroundModel\Policy\NetEnableGlobalPool | DWORD | 1 | Disables 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.