purplegreen MDM

purplegreen MDM is being prepared for its first pilot. These pages describe the development release.

Heartbeat ingest: minute-level offline detection

Google hears from a tablet roughly once a day, so "offline" from Google alone means "not seen for 26 hours" (What "offline" means). If your kiosk app already talks to your own server every minute, that server can tell purplegreen MDM that the tablet is alive. The device page then shows App last seen next to MDM last seen, and the Offline rule can use it ("The kiosk app checks in about every minute through the heartbeat key, so offline is noticed within minutes.").

Set it up

  1. In Settings > Heartbeat ingest, an owner or admin generates a key. It is shown once with a curl example ("Heartbeat key generated. Copy it now: it is not shown again.") and disappears when you leave the page or after 10 minutes.
  2. Your backend posts, about once a minute per tablet:

sh curl -X POST "https://<your purplegreen MDM host>/api/v1/ingest/heartbeat" \ -H "Authorization: Bearer pgh_..." -H 'Content-Type: application/json' \ -d '{"serialNumber":"R9TEST01","appVersionName":"2.1.0","appVersionCode":210}'

Use the tablet's serial number or its purplegreen MDM device id (deviceId); the app version fields are optional. A backend that reports many tablets sends them together, up to 100 per request:

json { "items": [ { "serialNumber": "R9TEST01", "appVersionCode": 210 }, { "deviceId": "..." } ] }

The answer is 200 with accepted and unknown (the serials and ids your organisation does not have). 3. In Alerts > Rules and channels, turn on "Use the app heartbeat instead of the MDM report" on the Offline rule, keep the rule on, and pick the app threshold (10 minutes by default).

A tablet that never sent a heartbeat keeps using Google's last seen. Offline changes are picked up within 5 minutes.

Answers your backend can get

Answer Meaning What to do
204 Stored (single tablet) Nothing
200 Batch stored: accepted count and the unknown serials or ids Check the unknown ones
400 The body is wrong (both or neither of serialNumber and deviceId, wrong types, more than 100 items, larger than 64 KB); one bad item rejects the whole batch Fix the request
401 Key missing, wrong, replaced or revoked, or the organisation is closed Generate a new key and update the backend
404 No tablet with that serial or id in your organisation Check the serial (upper or lower case and surrounding spaces do not matter)
429 Too many requests: your organisation may send max(120, 2 x enrolled tablets + 60) requests a minute (a batch counts as one), and an address that sends more than 30 requests a minute with a wrong key is blocked for the rest of the minute Wait for Retry-After; send one batch a minute instead of one call per tablet; fix the key

Replacing or revoking the key

"A new key replaces the current one at once: heartbeats with the old key are refused until your app or backend sends the new one." Until the backend has the new key, tablets that use the heartbeat turn Offline after the app threshold. Revoking stops heartbeats at once; the Offline rule then falls back to Google's last seen. Never put the key in the tablet app itself: keep it on your server.