r/FlutterDev • • 1d ago

Discussion I built an open-source, self-hosted Android device management platform with Flutter – Wonkru MDM

Wonkru MDM, my open-source Android device management project, is now live!

It's a free and open-source mobile device management platform I built to help businesses manage Android phones, tablets, handheld terminals, and other devices from a single dashboard.

With Wonkru MDM, you can:

  • Send commands to devices remotely.
  • Remotely install, uninstall, and update applications.
  • Apply security policies and device restrictions.
  • Configure devices for specific use cases using the custom launcher and kiosk mode.
  • Enroll devices using QR codes.

One of my main goals was to build an MDM platform that doesn't rely on external cloud services. You can host it on your own server without relying on any cloud services and even run it entirely within a local network without internet access.

I built the web dashboard and mobile application using Flutter, with Dart and Serverpod powering the backend.

The free and open-source version is currently available, and I'm planning to release a Pro version with more advanced features soon.

For anyone interested in checking out the project or trying it on their own server, here are the links:

9 Upvotes

5 comments sorted by

1

u/yumenoko22Classic 1d ago

This is actually huge. Every MDM I've used at work has been some bloated, cloud-dependent mess that costs a fortune per device. Having something self-hosted that runs on a local network is exactly what smaller shops need.

The QR enrollment is a nice touch, we've got a fleet of rugged tablets in a warehouse and setting them up one by one through GMS is a nightmare I wouldn't wish on anyone. How well does the kiosk mode handle app crashes or accidental reboots? That's always been my biggest headache, some devices would just boot back to the launcher and sit there until someone physically touched them.

Starred the repo, going to spin this up on a test VM this weekend. Been looking for an excuse to mess with Serverpod anyway.

1

u/Aksoyhlc 1d ago

Thanks for the GitHub star. Keeping the app running reliably, especially in launcher mode, was one of the biggest challenges I faced during development. I spent a lot of time on it.

The app uses a foreground watchdog service to check whether its activity is alive, whether Flutter is responding, and whether the app is in the foreground. If something goes wrong while launcher mode is enabled, the watchdog tries to reopen it. There’s also ANR detection, while AlarmManager and WorkManager help keep the watchdog service running. The MDM agent itself acts as the launcher. When launcher mode is enabled, the app checks and reapplies its default launcher assignment, including after a reboot.

The watchdog currently focuses on recovering the MDM app. It doesn’t automatically restart third-party apps after a crash.

1

u/kuarasoft 1d ago

Running it entirely on a local network rules out FCM for waking devices, so how do commands reach them: does each device keep a Serverpod streaming connection open from a foreground service, or poll on an interval? Doze and OEM battery killers tend to drop long-lived sockets on idle handheld terminals, so I'm wondering how quickly a lock or app install lands on a device that's been sitting untouched for an hour. Also, for QR enrollment without internet, do you serve the DPC APK from the same server for the provisioning download URL?

1

u/Aksoyhlc 1d ago

Each device maintains a bidirectional WebSocket connection to the server instead of polling. FCM isn't part of the picture. The app supports both regular and headless Flutter engines, so it keeps working when the UI is closed, another app is in front, or the screen is off. It sends a heartbeat every 60 seconds and tries to reconnect 20 seconds after detecting a disconnection. A native foreground watchdog service, together with AlarmManager and WorkManager, helps keep the agent running.

The server stores commands in PostgreSQL and delivers them right away when the device is connected. If it's offline, they stay in the database until it reconnects. In my testing so far, I haven't seen any noticeable command delivery delays, even under deep Doze. OEM power management can change that, though, so I can't promise the same response time on every device. I'd be interested in your test results too. The more devices we can test on, the better. And yes, the same self-hosted server serves the DPC APK. The provisioning QR code includes the APK download URL, the SHA-256 checksum, Wi-Fi settings, the server URL, and the enrollment key.

1

u/VisualRope8367 1d ago

Very nice idea

I needed something like this for my mom's mobile

I will check it out