●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens
Implementing Screen Time Control Apps with Rork Max — Family Controls / DeviceActivity / ManagedSettings
A complete walkthrough for shipping a Screen Time-style app with Rork Max — covering Family Controls authorization, DeviceActivity scheduling, and ManagedSettings shielding via custom native modules and a DeviceActivityMonitor extension.
Close a few social apps at 10 p.m. — it sounds like a one-line spec. Then you start building, and the first wall isn't the UI or the logic. It's a capability Apple hands out by review, and a separate process that runs without your main app.
Family Controls, DeviceActivity and ManagedSettings all hinge on the Family Controls entitlement, and when the schedule fires, your main app is not guaranteed to be running. Start from the JS side without knowing that and you will redo work.
What follows is the smallest "night shield" for an Expo-based Rork project, from entitlement request to review submission. It assumes some custom-native-module experience, but each step is laid out in order.
What I'd put first is this line: JS handles authorization, launching the picker and registering the schedule — the extension does the actual blocking.
I'd draw that line on paper before opening Swift; swapping the order may be where most of the rework comes from.
Why Rork Defaults Cannot Ship a Screen Time App
Out of the box, Rork Max bundles the standard Expo SDK modules: camera, notifications, location, secure storage, and so on. None of the three Screen Time frameworks ride on that train. Specifically:
The FamilyControls framework refuses to even compile without the com.apple.developer.family-controls entitlement on your provisioning profile
The DeviceActivity framework's "fire a callback when this time window starts" mechanism is delivered as an App Extension target — not in your main app — because the OS calls it when your app is not running
ManagedSettings, which actually applies the shield, depends on shared state between the main app and the extension via an App Group container
For a typical "swipe through screens" app, Rork's Vibe Coding loop covers 95% of what you need. Screen Time work, however, crosses three boundaries at once: OS-level permissions, extension targets, and shared data. Trying to fake any of these layers is the fastest way to lose a weekend. The pragmatic move is to set up the right architecture from day one — Rork main app, Swift native module, Extension target, App Group — and never look back.
Architecture: The Three Frameworks at a Glance
Before we start writing code, let's pin down what each framework actually does. Confusing them is the most common source of "why won't this work" sessions later.
FamilyControls is the consent and selection layer. It owns the prompt that asks the user to grant Screen Time access, and it owns FamilyActivityPicker, the SwiftUI component that lets the user pick which apps and categories to govern. The user's choice comes back as a FamilyActivitySelection — a privacy-preserving opaque token, not a list of bundle IDs
DeviceActivity is the scheduling layer. It says "when this time window opens, wake up an extension" or "when this app has been used for 30 minutes today, notify me." The extension runs even when your main app is terminated
ManagedSettings is the enforcement layer. Hand a FamilyActivitySelection to a ManagedSettingsStore, and the OS immediately blocks those apps with a system shield UI
So the architecture is a three-stage rocket: pick targets (FamilyControls) → register schedule (DeviceActivity) → block on cue (ManagedSettings).
How This Maps to a Rork Project
This is the layout used throughout the article:
Main app (Rork Max build): React Native UI, calls into Swift via the custom Expo module
Native Module (Swift): bridges authorization requests, picker presentation, schedule registration, and shield management to JS
DeviceActivityMonitor Extension (Swift): a separate target. The OS wakes it up at schedule boundaries; it pulls the saved selection from shared storage and applies the shield
App Group: group.{your-bundle-id}.shield added to both targets, used as the single source of truth for the user's blocklist via UserDefaults(suiteName:)
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦Anyone stuck on why Rork Max alone cannot ship a Screen Time app will walk away with a working three-framework integration — Family Controls, DeviceActivity, ManagedSettings — embedded as a custom Expo module.
✦You'll have Swift modules for FamilyActivityPicker presentation, DeviceActivityCenter scheduling, and a dedicated DeviceActivityMonitor extension with App Group data sharing — including the per-extension entitlement requests that are easy to miss.
✦You'll know how to dodge the five most common shipping pitfalls (FamilyActivitySelection privacy boundaries, App Group misnaming, jetsam crashes in extensions, child-mode simulator failures, App Review rejections) and submit a build with the right review notes.
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
Step 1: Entitlement Request and Xcode Configuration
The Family Controls entitlement is gated by a manual Apple review. You request it through Apple's "Requesting the Family Controls entitlement" page. Review times are not fixed, so leave yourself room in the schedule.
The easy-to-miss part: the request is not covered by the main app alone. Apple Developer Technical Support has stated on the Developer Forums that extensions such as DeviceActivityMonitor and DeviceActivityReport need their own Family Controls (Distribution) request; approval for the main app does not carry over. Plan on one request per bundle ID you ship.
In practice, drawing up this table first heads off half of the pitfalls later on. I recommend counting your requests before you add targets.
Before approval you can still develop and test on a device with the development entitlement, but a build uploaded to App Store Connect needs the Distribution one. Make the request your first move.
In Xcode, both the main app target and the extension target need these entries in their .entitlements:
Expected outcome: the build no longer fails with "Provisioning profile doesn't include the com.apple.developer.family-controls entitlement." If it does, your request hasn't been approved yet, or you need to regenerate the profile after approval.
Step 2: A Custom Native Module in Rork Max
There are several ways to add a native module to a Rork Max project; here we use a local Expo Modules API module. Modules under modules/ are autolinked, so the Swift code doesn't need to be pasted back in at every eas build.
The extension target is a different story. In Expo's managed workflow the ios/ directory is regenerated by prebuild, so a target you added by hand in Xcode disappears on the next prebuild. Declare the extension through a config plugin such as expo-apple-targets, which offers the target types device-activity-monitor, shield-config and shield-action; npx create-target device-activity-monitor scaffolds one.
# Run from the project rootnpx create-expo-module@latest --local modules/screen-time-control
This scaffolds modules/screen-time-control/. Replace ios/ScreenTimeControlModule.swift with the following bridge:
// modules/screen-time-control/ios/ScreenTimeControlModule.swiftimport ExpoModulesCoreimport FamilyControlsimport ManagedSettingsimport DeviceActivitypublic class ScreenTimeControlModule: Module { // Shared between main app and extension via App Group private let appGroup = "group.com.example.screentimecontrol.shield" public func definition() -> ModuleDefinition { Name("ScreenTimeControl") // Ask for Family Controls authorization (call once on first launch) AsyncFunction("requestAuthorization") { (promise: Promise) in Task { do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) promise.resolve(true) } catch { promise.reject("AUTH_FAILED", "Family Controls authorization failed: \(error.localizedDescription)") } } } Function("authorizationStatus") { () -> String in switch AuthorizationCenter.shared.authorizationStatus { case .approved: return "approved" case .denied: return "denied" case .notDetermined: return "notDetermined" @unknown default: return "unknown" } } // Schedule a recurring shield window (e.g. 22:00 -> 07:00) AsyncFunction("scheduleNightShield") { (startHour: Int, endHour: Int, promise: Promise) in let intervalStart = DateComponents(hour: startHour) let intervalEnd = DateComponents(hour: endHour) let schedule = DeviceActivitySchedule( intervalStart: intervalStart, intervalEnd: intervalEnd, repeats: true ) let center = DeviceActivityCenter() do { try center.startMonitoring(.nightShield, during: schedule) promise.resolve(true) } catch { promise.reject("SCHEDULE_FAILED", error.localizedDescription) } } AsyncFunction("stopShield") { () -> Bool in DeviceActivityCenter().stopMonitoring([.nightShield, .testShield]) let store = ManagedSettingsStore() store.shield.applications = nil store.shield.applicationCategories = nil return true } }}extension DeviceActivityName { static let nightShield = Self("nightShield") static let testShield = Self("testShield")}
The detail worth explaining: the module only registers and cancels the schedule (startMonitoring / stopMonitoring); applying the shield at the start time is left to the extension. Nothing guarantees your main app is running at 22:00, so anything triggered by the clock belongs in the process the OS wakes up on its own. The one exception is stopShield, which runs when the user taps a button on screen, so it touches ManagedSettingsStore from the main app.
Step 3: Calling FamilyActivityPicker from JS
The "let the user pick which apps to block" UI must use Apple's first-party FamilyActivityPicker. Trying to reproduce this picker in React Native is a dead end — the tokenization model breaks the moment you cross the bridge.
// PickerView.swift - SwiftUI wrapperimport SwiftUIimport FamilyControlsstruct AppPickerView: View { @State private var selection = FamilyActivitySelection() @Environment(\.dismiss) var dismiss let onComplete: (FamilyActivitySelection) -> Void let onCancel: () -> Void var body: some View { NavigationView { FamilyActivityPicker(selection: $selection) .navigationBarItems( leading: Button("Cancel") { onCancel() dismiss() }, trailing: Button("Done") { onComplete(selection) dismiss() } ) } }}
Add a method to the native module to present this view:
// Append to ScreenTimeControlModule.swiftAsyncFunction("presentAppPicker") { (promise: Promise) in DispatchQueue.main.async { guard let rootVC = UIApplication.shared.connectedScenes .compactMap({ ($0 as? UIWindowScene)?.keyWindow?.rootViewController }) .first else { promise.reject("NO_VC", "No root view controller") return } let picker = AppPickerView(onComplete: { selection in // Encode and persist to the App Group container let encoder = PropertyListEncoder() if let data = try? encoder.encode(selection), let defaults = UserDefaults(suiteName: self.appGroup) { defaults.set(data, forKey: "blockedApps") promise.resolve([ "applicationCount": selection.applicationTokens.count, "categoryCount": selection.categoryTokens.count ]) } else { promise.reject("ENCODE_FAILED", "Could not encode selection") } }, onCancel: { // Always settle the promise on cancel, or the JS await hangs forever promise.resolve(["cancelled": true]) }) let host = UIHostingController(rootView: picker) rootVC.present(host, animated: true) }}
Expected behavior: from React Native, await ScreenTimeControl.presentAppPicker() opens Apple's native app picker. Once the user taps "Done," the JS call resolves with the count of selected apps and categories; on "Cancel" it resolves with cancelled: true. The actual token data — for privacy reasons — never crosses the JS bridge; it lives in the App Group and is consumed by the extension.
Step 4: Implementing the DeviceActivityMonitor Extension
This is the linchpin. The OS calls into this extension at the moment your schedule window opens.
You can add the target with File > New > Target > Device Activity Monitor Extension in Xcode, or with npx create-target device-activity-monitor as above — the latter is the safer choice in a managed workflow. Replace the generated DeviceActivityMonitorExtension.swift with:
// DeviceActivityMonitorExtension.swiftimport DeviceActivityimport ManagedSettingsimport Foundationclass DeviceActivityMonitorExtension: DeviceActivityMonitor { let store = ManagedSettingsStore() let appGroup = "group.com.example.screentimecontrol.shield" override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) // Pull the FamilyActivitySelection out of the App Group guard let defaults = UserDefaults(suiteName: appGroup), let data = defaults.data(forKey: "blockedApps") else { return } let decoder = PropertyListDecoder() guard let selection = try? decoder.decode(FamilyActivitySelection.self, from: data) else { return } // Apply the shield store.shield.applications = selection.applicationTokens.isEmpty ? nil : selection.applicationTokens store.shield.applicationCategories = selection.categoryTokens.isEmpty ? nil : .specific(selection.categoryTokens) } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) store.shield.applications = nil store.shield.applicationCategories = nil }}
The OS launches this extension in the background. Its time and memory budgets are tight, and Apple does not publish the limits, so keep network calls and heavy work out. Treat this extension as "load the saved selection, apply or remove the shield, exit." Anything more belongs in the main app.
Step 5: The React Native Surface
With the native side in place, the JS side stays small:
Expected flow on first run: tapping Authorize triggers the OS Screen Time dialog. After approval, the user picks apps via the system picker, then enables the schedule. At 22:00 sharp, the OS wakes the extension, applies the shield, and the user sees the system-level block screen on every selected app — exactly as in Apple's first-party Screen Time UI.
Common Pitfalls and How to Avoid Them
These are five spots where Screen Time projects commonly lose time. Apple's docs don't cover them in one place.
1. "I'm trying to send the FamilyActivitySelection over to JS and it's empty"
The contents of FamilyActivitySelection (the application tokens) are opaque by design for privacy. There is no design path for pulling bundle IDs or app names out and handing them to JavaScript. The correct pattern is to return only the count to JS, persist the selection to the App Group, and let the extension consume it.
2. "The shield never fires when the schedule opens"
Most often this is a misconfiguration on the extension target. Run through this checklist:
Is the extension's Bundle ID a child of the main app, e.g. {main-app-id}.deviceactivitymonitor?
Does the extension's .entitlements include both com.apple.developer.family-controls = true and the App Group?
Has the extension's own Bundle ID been through the Family Controls request and approval (separate from the main app, as covered above)?
Do both targets belong to the same App Group?
Does the extension's Info.plist set NSExtensionPrincipalClass to $(PRODUCT_MODULE_NAME).DeviceActivityMonitorExtension?
3. "UserDefaults(suiteName:) reads come back nil from the extension"
If the App Group string differs by a single character, the read just returns nil — no warning, no log. Something like group.com.example.screentimecontrol.shield versus group.com.example.screentime.shield is enough. Open the Capabilities pane on both targets and copy-paste the App Group string between them; do not type it twice.
4. "Release builds crash where Debug builds were fine"
DeviceActivity extensions have little memory headroom, and code that passes in Debug can be killed by jetsam in Release. Apple doesn't publish the cap, so don't rely on a remembered number — keep the extension's body minimal, and keep crash-reporting SDKs and heavy logging out of it.
5. ".child authorization fails on the simulator"
requestAuthorization(for: .child) assumes a child device tied to a parent's Family Sharing group, and Screen Time features are best verified on a real device rather than the simulator. Budget time for building a real test family of Apple IDs. If the app is for a user's own focus, .individual is enough.
A Test Schedule, and Never Failing Silently
While going back over this sample, I noticed that handleSchedule had no try. If startMonitoring throws, nothing on screen tells you. You assume the extension is misconfigured, and you end up bouncing between Capability panes for an evening — the most expensive way to lose time on this API.
The first fix is to surface the failure exactly as the native side reports it. Before and after:
Next, add a one-off test schedule to the module, so you can check on a real device without waiting for 22:00. It opens a few minutes from now and closes a while later.
// Add to ScreenTimeControlModule.swift (test-only, non-repeating schedule)AsyncFunction("scheduleTestShield") { (startInMinutes: Int, durationMinutes: Int, promise: Promise) in let cal = Calendar.current let now = Date() guard let start = cal.date(byAdding: .minute, value: startInMinutes, to: now), let end = cal.date(byAdding: .minute, value: startInMinutes + durationMinutes, to: now) else { promise.reject("DATE_FAILED", "Could not build schedule dates") return } let parts: Set<Calendar.Component> = [.hour, .minute, .second] let schedule = DeviceActivitySchedule( intervalStart: cal.dateComponents(parts, from: start), intervalEnd: cal.dateComponents(parts, from: end), repeats: false ) do { try DeviceActivityCenter().startMonitoring(.testShield, during: schedule) promise.resolve(true) } catch let error as DeviceActivityCenter.MonitoringError { // The case name (e.g. intervalTooShort) reaches JS unchanged promise.reject("SCHEDULE_FAILED", String(describing: error)) } catch { promise.reject("SCHEDULE_FAILED", error.localizedDescription) }}
The testShield name on DeviceActivityName, and .testShield in the stopMonitoring call inside stopShield, are already in the Step 2 listing. The extension's intervalDidStart applies the saved selection regardless of the activity name, so it fires for the test window too.
From JS, call await ScreenTimeControl.scheduleTestShield(2, 20): start in two minutes, run for twenty. Shrink the window to a few minutes and registration itself is refused with MonitoringError.intervalTooShort. Apple's documentation lists the error cases but not the minimum length; on the Developer Forums and in write-ups from other developers, fifteen minutes comes up again and again. I haven't been able to confirm an official number as of November 2026, so I leave some margin and test with twenty.
A failed registration always goes on screen. The quieter an API fails, the more this one rule pays off.
Working Backwards from the Symptom
Here are the five pitfalls above, rearranged so you can start from what you're seeing. Checking from the top down keeps rework to a minimum.
Symptom
Likely cause
How to check
Fix
Build fails with "Provisioning profile doesn't include the com.apple.developer.family-controls entitlement"
Entitlement not yet approved, or a stale profile
Look at the Bundle ID's capabilities under Identifiers in your Apple Developer account
Regenerate the profile after approval and refresh EAS credentials
Error right after registering (intervalTooShort)
The window is too short
Read the case name shown by the "after" version of handleSchedule
Test with a window of about twenty minutes
Registration succeeds, nothing happens at the start time
Extension Bundle ID, entitlement, or NSExtensionPrincipalClass
Filter Console.app by the extension's process name and see whether it launched
Work through the five items in pitfall 2
The extension launches but no shield appears
App Group mismatch, so the selection reads back as nil
Log whether defaults.data(forKey:) is nil inside the extension
Make both targets' App Group strings identical
With many apps selected, only some are shielded
A per-store token limit (developers report 50)
Compare how many apps were picked with how many are shielded
Shield by category, or split tokens across named stores
The shield stays after tapping "release"
stopMonitoring was called but the store wasn't cleared
Open a shielded app right after releasing
Set shield.applications and applicationCategories to nil from the main app
Choosing the Authorization Type and Where the Shield Lives
Two decisions trip people up. Change either one later and you'll be rewriting your review notes and on-screen explanations as well.
Choice
Good fit
Requires
Watch out for
.individual authorization
Self-imposed focus or wind-down limits
iOS 16 or later, the user's own device
The user can revoke it in Settings at any time
.child authorization
Parents supervising a child's device
An Apple ID set up as a child in Family Sharing
Test setup takes time; hard to verify on the simulator
Shield immediately from the main app
A "start focusing now" button
The app is in the foreground
Unusable for anything triggered by the clock
Shield from the extension on a schedule
"Every night from 22:00"
A DeviceActivityMonitor extension and an App Group
Keep the extension's work minimal
The rule fits in a sentence: .individual when people restrict themselves, .child when a parent supervises another device — and anything driven by the clock lives in the extension, anything driven by a tap lives in the app.
Three Misunderstandings Worth Clearing Up
First: "calling stopMonitoring triggers intervalDidEnd, so the shield comes off." There are several Developer Forums threads where intervalDidEnd simply never arrives, and I'd rather not depend on it. That's why stopShield in this guide both stops monitoring and clears the store from the main app.
Second: "I can list the picked apps' names in JS." The tokens are opaque by design; there's no string name to pull out. If you want to show what was picked, hand the token to SwiftUI — for example Label(token) — and let the OS draw it.
Third: "I'll iterate quickly with one- or two-minute windows." As the earlier section shows, windows that short are rejected at registration. Start soon, but leave the duration generous — that turned out to be the fastest way to iterate.
Where You'll Likely Get Stuck Next
Once the night shield works, the next wall for most people is that adding a native module means Expo Go no longer runs the app. Moving to a development build is covered in setting up Expo Dev Client for a Rork app.
Screen Time apps get a close look at purpose. The single most useful step is making it dead obvious to the reviewer what the app controls, on whose device, and how the user consents. Put these three points in the App Review Notes:
The purpose of the app (e.g. "personal focus support" or "parental controls for minors")
The authorization flow: which screen asks, and after what explanation
That FamilyActivitySelection data stays on-device and is never transmitted to a server
The text of the system authorization dialog cannot be changed by the app — Apple has said on the Developer Forums that it isn't customizable — and an Info.plist usage-description key added for it has no effect. So explain the request on your own screen just before calling requestAuthorization.
One more thing to align: if that screen says "from 22:00 to 07:00, only the apps you choose are blocked," the shield's actual scope should match those words. Treat the explanation and the behavior as a single contract.
Wrapping Up — Ship the Smallest Possible Version First
Framework, entitlement, extension and shared container all have to line up, which makes this one of the more hands-on categories on iOS. The UI and most of the logic stay in React Native; the Apple-side integration is Swift.
Two first steps: request the Family Controls entitlement for the main app and for the extension, and add the device-activity-monitor target through a config plugin. While approval is pending, wire up the code from this guide so you can build the day it lands.
A basic schedule that fires the shield fits in half a day. After that it's iteration: more schedules, web-domain blocking via store.webDomains, usage statistics via DeviceActivityReport. Because the app intervenes in what people do, re-check that the explanation and the behavior still match every time you add a feature.
Your next action is one test: on a real device, call scheduleTestShield(2, 20), close the app, and confirm the shield fires two minutes later.
Share
Thank You for Reading
Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.