Repository navigation
Commands and Command Queue
CORE MDM commands are queued and cancellable. This page explains the model, the four command types, and how cancellation is guaranteed safe.
Each device has a subcollection /devices/{deviceId}/commands. A command document looks like:
{
type: "lock" | "reboot" | "wipe" | "lockdown",
state: "pending" | "executed" | "cancelled",
createdAt: Timestamp,
executedAt: Timestamp, // set when the device runs it
issuedBy: "admin@example.com"
}
-
Dispatch — the console adds a doc with
state: "pending". -
Listen — the device's queue listener (
whereEqualTo("state","pending")) sees it. -
Claim — the device runs
claimCommand, a Firestore transaction that re-reads the doc and flipspending → executedonly if it's still pending. - Execute — if the claim wins, the device runs the action.
-
Cancel — if the admin pressed Cancel first,
stateis alreadycancelled; the transaction aborts and the device does nothing.
Because the claim is a transaction, a command executes at most once, even across reconnects or duplicate listener fires, and a cancel that lands before the claim always wins.
| Type | Effect | Requires |
|---|---|---|
| lock | Locks the screen immediately (lockNow()) |
Device Admin |
| reboot | Reboots the device | Device Owner |
| wipe | Factory-resets the device (external storage not included) | Device Admin |
| lockdown | Applies the full-lockdown bundle (safe boot, factory reset, debugging, add-user, installs, Wi-Fi/Bluetooth/cellular config all blocked; status bar, screen capture, camera disabled) and syncs those policy values | Device Owner for the full effect |
Alarm is not a queued command — it's the boolean field
alarmActiveon the device doc, toggled instantly. Cancellation doesn't apply.
- Open a device → Commands tab.
- Press Lock Screen / Reboot / Apply Full Lockdown (Wipe is under Danger).
- The command appears under Pending Commands with the type and age.
- Press Cancel to stop it before the device picks it up. If the device already claimed it, Cancel has no effect (it already ran).
Because the emulator/device polls fast, the pending window can be short — Cancel is most useful when the device is briefly offline or slow.
A command queued while the device is offline stays pending and is delivered when the device reconnects (Firestore replays the listener). To stop it, cancel it while still offline.
Apply Full Lockdown writes the whole set of policies.* lockdown values and enqueues a lockdown command. Writing the policy values too keeps the policy map consistent — otherwise the next single-policy change would re-apply stale false values and silently undo the lockdown.
- Policies Reference — the persistent toggles (not commands)
- Security Rules — who can create/cancel commands and who can mark them executed
- Firestore Data Model — the command document schema
CORE MDM — Repository · Console · Releases · Beta
Getting started
Using it
- Web Console Guide
- Commands and Command Queue
- Policies Reference
- App Management
- Content Filter and DNS
- Kiosk Mode
- PIN and Security
- Enrollment and Provisioning
How it works
Operations
Help