A universal, multi-vector "Don't Kill My App!" toolkit — one shared OEM knowledge base powering a CLI, a desktop GUI, a self-hostable web guide, root & Magisk installers, an Android library, and a Kotlin Multiplatform module.
⭐ If DKMA Monster saved your background app, please star the repo — it helps others find it.
Built by David Linacre · linacre.site
Android's biggest reliability problem isn't Android — it's what OEMs bolt on top. Xiaomi (MIUI/HyperOS), Huawei, OPPO, vivo, Samsung and others ship aggressive, undocumented background killers with no public API. Your alarm, tracker, messenger or sync silently dies and users blame your app.
DKMA Monster attacks the problem from every angle at once, all driven by a
single source of truth — data/oem_registry.json.
| Vector | What it does | Automatic? |
|---|---|---|
🔌 ADB installer (adb/dkma.py) |
Detects the OEM, grants what ADB can, opens each vendor screen, then verifies each step | Semi (taps for UI-only toggles) |
🖥️ Desktop GUI (gui/server.py) |
Point-and-click front end over the ADB engine: plug in phone → pick app → Fix | Semi (browser-driven) |
🧿 Root installer (root/dkma-root.sh) |
Flips appops / doze / standby / vendor autostart with su |
✅ Fully |
🧩 Magisk module (magisk/) |
Re-applies keep-alive settings on every boot for a package list | ✅ Fully, persistent |
📱 Android library (android/) |
In-app guided wizard + authoritative MIUI autostart read | Semi (guided) |
🧬 KMP module (kmp/) |
Share the registry + detection across Android / iOS / JVM / JS | Library |
🌐 Web dashboard (web/build.py) |
Generates a searchable, self-hostable keep-alive guide from the registry | — |
🧠 OEM registry (data/oem_registry.json) |
Single source of truth — components + fallbacks for 15 OEM families | — |
Xiaomi / Redmi / POCO · Samsung · Huawei / Honor · OPPO · vivo / iQOO · OnePlus · realme · Meizu · ASUS · Sony · Nokia / HMD · Google / Android One · Motorola / Lenovo · Nothing · Tecno / Infinix / itel — plus a generic fallback for anything unknown.
On a stock, non-rooted phone, no tool can silently flip Autostart, "MIUI optimizations", "protected apps" or the per-app battery profile — they are UI-only toggles with no API, by vendor design. So:
- Without root → DKMA does every automatable grant (Doze whitelist, standby bucket, background appops), drives you straight to each remaining toggle (≈1 minute of tapping), then verifies what it can (see below).
- With root / Magisk → nearly everything becomes fully automatic and survives reboots.
Anyone promising a stock, no-root, zero-tap "fix" is either using root or lying.
After each step, DKMA re-reads device state to prove whether it worked, and is honest when it can't:
| Step | Proven via | API? |
|---|---|---|
| battery optimization / stamina | dumpsys deviceidle whitelist |
✅ |
| background / keep-running | appop RUN_ANY_IN_BACKGROUND + standby bucket |
✅ |
| autostart | appop AUTO_START (MIUI) / DkmaAutostart reflection |
|
| MIUI optimizations / protected apps / battery profile | no readable state | ❌ → honestly flagged |
# prerequisites: adb on PATH + USB debugging enabled on the phone
python3 adb/dkma.py com.your.app # detect OEM → grant → guide → verify
python3 adb/dkma.py com.your.app --tui # interactive checklist (arrow keys)
python3 adb/dkma.py com.your.app --auto # grants only, no pauses
python3 adb/dkma.py com.your.app --dry-run # print commands, change nothing
python3 adb/dkma.py com.your.app --json # machine-readable report (CI/QA)
python3 adb/dkma.py --list # list connected devicesExit codes: 0 ok · 1 usage/device error · 2 adb missing · 3 partial.
python3 gui/server.py # opens http://127.0.0.1:8765Plug in the phone, pick the app, click Fix everything (or Dry run).
Preview the UI without a phone: open gui/preview.html.
python3 web/build.py # generate the site into web/site/
python3 -m http.server -d web/site 8080 # optional local previewStatic output — host on GitHub Pages, Netlify, Cloudflare Pages, S3, or open
web/site/index.html directly.
adb push root/dkma-root.sh /sdcard/
adb shell "su -c 'sh /sdcard/dkma-root.sh com.your.app'"cd magisk && sh build-zip.sh # → dkma-monster-magisk.zip
# flash in Magisk, then add packages to /data/adb/dkma/apps.list and reboot// zero-dependency engine
if (DkmaMonster.needsAttention(context)) {
DkmaMonster.runGuidedSetup(activity) // opens each required screen in order
}
// or the ready-made Compose wizard UI kit
setContent { MaterialTheme { DkmaWizardScreen(onFinish = { finish() }) } }
// authoritative MIUI/HyperOS autostart read (no external dependency)
when (DkmaAutostart.getState(context)) {
DkmaAutostart.State.ENABLED -> { /* proven ON → don't nag */ }
DkmaAutostart.State.DISABLED -> { /* proven OFF → send to Autostart screen */ }
else -> { /* unknown/unsupported → fall back to guiding */ }
}See android/README.md. For multiplatform apps, use the
kmp/ module instead.
data/oem_registry.json ← edit ONLY this
│
┌───────────────┬──────────┼───────────┬──────────────────┬─────────────┐
▼ ▼ ▼ ▼ ▼ ▼
adb/dkma.py gui/server.py web/build.py tools/gen_*.py root/ · magisk/
(reads JSON) (reads JSON) (reads JSON) → DkmaRegistry.kt (Android)
→ DkmaRegistryData.kt (KMP)
- The CLI, GUI and web generator read the JSON directly, so they can't drift.
- The Android & KMP libraries can't read the file at build time, so
tools/build_all.pygenerates their registries from it — andtools/build_all.py --check(run in CI) fails the build if they're stale.
python3 tools/build_all.py # regenerate every derived artifact
python3 tools/build_all.py --check # CI: validate + fail on driftdkma-monster/
├── data/oem_registry.json # 🧠 single source of truth (15 OEMs)
├── adb/dkma.py # cross-platform ADB installer (TUI/JSON/dry-run/verify)
├── gui/ # desktop GUI: stdlib server + HTML front end (+ preview)
├── web/build.py # static-site generator → web/site/
├── android/ # DkmaMonster, DkmaAutostart, DkmaWizard, DkmaRegistry(gen)
├── kmp/ # Kotlin Multiplatform module (common + android/jvm/ios/js)
├── root/dkma-root.sh # fully-automatic root installer
├── magisk/ # persistent Magisk module + build-zip.sh
├── tools/ # codegen + single-source build/drift orchestrator
├── docs/ # HOW-IT-WORKS · CONTRIBUTING · ROADMAP
└── .github/workflows/ci.yml # registry validation + drift guard + compiles
- Autostart / auto-launch → ON
- Battery → Unrestricted / No restrictions
- Keep running after screen off → ON
Plus: for genuinely long-lived work, run a foreground service — the most reliable pattern on aggressive OEMs regardless of these toggles.
The most valuable contribution is accurate vendor Activity names for new ROM versions. It's a one-file edit + regenerate:
- Edit
data/oem_registry.json(seedocs/CONTRIBUTING.md). - Run
python3 tools/build_all.py. - Commit the JSON and the regenerated files.
CI drift-checks everything, so nothing can fall out of sync.
Knowledge distilled from the community effort at dontkillmyapp.com and the MIUI-autostart technique. Design language inspired by and built by David Linacre · linacre.site.
MIT — do whatever, no warranty. Killing OEM battery managers is a public service.
