I have a couple of questions on the FamilyActivityPicker that I couldn't seem to find in the documentation:
Is there any way to have it show only apps or websites? I've had some users reach out with frustrations because they want to select a category of apps (e.g. "Social"), but that also selects a lot of websites that they don't want to include.
Where does the picker get the websites that it populates? It seems like there's not much rhyme or reason to these (and there's often multiple urls for the same site - e.g. facebook.com and m.facebook.com).
Is there any way (as a developer) to have preset app selections available upon download? For example, can I have an option that has certain apps in the Social category chosen by default so that each user doesn't have to go in and manually select all of the apps they want?
Family Controls
RSS for tagPrevent access to the Screen Time API without guardian approval and provide opaque tokens that represent apps and websites.
Posts under Family Controls tag
184 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
我想通过 applicationToken 展示应用图标和应用名称,只查找到使用Label(applicationToken)来展示,但是展示的图标大小和图标名称字体,颜色均无法修改。是需要如何设置?还是需要其它方式来展示
Hello,
I developed a parental control app, this app has two clients one for the child and one for the parent. I could implement screen time to retrieve the child's screen time data and show it to the child by ActivityReportExtension but I didn't find any document to implement this feature on the parent device. I mean like the Apple screen time, parents can see their children's screen time (in the settings>screen time) I need to implement ActivityReportExtension in the parent client of my app that shows the child's screen time.
is it possible or this API is only restricted to Apple itself?
Hello,
I'm working on an app that makes use of Screen Time features by leveraging the Family Controls, Device Activity and Managed Settings frameworks.
The main app works fine by shielding/unshielding apps with a toggle.
When it comes to monitoring the time intervals with the Device Activity Monitor (DAM) extension (e.g. lock X apps for Y minutes), I'm experiencing several issues.
To shield/unshield apps and kick off the monitoring I perform the following instructions:
let timeInMinutes = 15
let startDate = Date(timeIntervalSinceNow: 1.0) // padding added to avoid invalid DAM ranges < 15 mins.
let endDate = startDate.addingTimeInterval(timeInMinutes * 60.0)
let components: Set<Calendar.Component> = [.day, .month, .year, .hour, .minute, .second]
let calendar = Calendar.current
let intervalStart = calendar.dateComponents(components, from: startDate)
let intervalEnd = calendar.dateComponents(components, from: endDate)
let schedule = DeviceActivitySchedule(intervalStart: intervalStart, intervalEnd: intervalEnd, repeats: false)
try deviceActivityCenter.startMonitoring(.definiteShield, during: schedule)
let managedSettingsStore = ManagedSettingsStore()
managedSettingsStore.shield.applications = selection.applicationTokens // `selection` being an instance of `FamilyActivitySelection`
The main pain points are:
After this code is performed, I would expect the Device Activity Monitor extension to start, or at least to start once I go to background. To check whether the DAM extension is running or not, I attach to the extension process manually (Product > Attach to Process by PID or Name). But I can see the extension correctly running only after 3-4 attempts of calling startMonitoring.
Even when the DAM extension runs, intervalDidStart and intervalDidEnd methods in the extension are called quite randomly - most of the times not being called at all - thus making the extension hugely unaffordable.
Please note:
I already ask for Screen Time permissions during the onboarding by calling AuthorizationCenter.shared.requestAuthorization(for: .individual), so by the time the user shields the apps, these permissions are already granted.
I already have Family Control entitlements for development and distribution, and for both the main target and the DAM extension target.
In the intervalDidEnd method, I simply call ManagedSettingsStore().clearAllSettings() and DeviceActivityCenter().stopMonitoring(). This looks like to be enough to stay way below the 6MB memory limit.
Am I doing something wrong, is there a way to fix this, or is just the Device Activity framework that is unstable?
Hi,
How to change title, subtitle, primaryButtonLabel, secondaryButtonLabel values according to iPhone language?
I noticed that the Shield Configuration Extension only runs once, when I turn on shield. Currently I can't find a way to run the Shield Configuration Extension again.
Thanks!
I am using the DeviceActivityMonitor eventDidReachThreshold functionality, but it became very unreliable on the iOS 17.5 beta.
Anyone experiencing similar problems?
Any known workarounds?
Hi there,
I'm currently working with the Screen Time API using the family controls package to manage application usage on iOS devices. I want to block access to all applications except those specifically allowed by the user. While the ManagedSettingsStore.shield.applications method works for defining apps to block. However, integrating the .all(except:) from ShieldSettings.ActivityCategoryPolicy.all(except:) is unfortunately not working for me.
Here is my code snippit. Can anyone help out? And if anyone has examples of similar implementations or tips on best practices for using the Screen Time API for such scenarios, please let me know!
class ShieldManager: NSObject, ObservableObject, NFCNDEFReaderSessionDelegate {
@Published var discouragedSelections = FamilyActivitySelection()
private let store = ManagedSettingsStore()
func shieldActivities() {
// Clear to reset previous settings
store.clearAllSettings()
// This is an array with the app and category selection
let applications = discouragedSelections.applicationTokens
let categories = discouragedSelections.categoryTokens
//
//https://developer.apple.com/documentation/managedsettings/shieldsettings/activitycategorypolicy
store.shield.applications = applications.isEmpty ? nil : applications
store.shield.applicationCategories = categories.isEmpty ? nil : .specific(categories)
store.shield.webDomainCategories = categories.isEmpty ? nil : .specific(categories)
}
f
I'm working on creating a locker app to lock the selected applications.
After locking app, when you try to open the app a screen appears with the below message.
Icon
Restricted
You can not use Facetime because it is restricted
OK Button.
How to customise this screen, another locker app is able to customise it and on a button click it redirects to their app to unlock it.
also is there a way to get locked app names?
I've noticed that the screen time shield has trouble populating when instagram stories are open. That has me thinking, what are other known hiccups with the screen time API technology? Would love others to contribute their thoughts, problems, solutions, and collaborations.
Both view and modifier versions of the FamilyActivityPicker crash randomly when selecting some items (usually the other option) throwing these in the console:
[com.apple.FamilyControls.ActivityPickerExtension(1150.1)] Connection to plugin invalidated while in use
AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:22091 (
0 AXRuntime 0x00000001c603b0fc _AXGetPortFromCache + 800
1 AXRuntime 0x00000001c603cce0 AXUIElementPerformFencedActionWithValue + 700
2 UIKit 0x0000000230de3ec8 DDE6E0C5-2AC3-3C73-8CFE-BC88DE35BB5F + 1453768
3 libdispatch.dylib 0x0000000103ef0b98 _dispatch_call_block_and_release + 32
4 libdispatch.dylib 0x0000000103ef27bc _dispatch_client_callout + 20
5 libdispatch.dylib 0x0000000103efa66c _dispatch_lane_serial_drain + 832
6 libdispatch.dylib 0x0000000103efb408 _dispatch_lane_invoke + 408
7 libdispatch.dylib 0x0000000103f08404 _dispatch_root_queue_drain_deferred_wlh + 328
8 libdispatch.dylib 0x0000000103f07a38 _dispatch_workloop_worker_thread + 444
9 libsystem_pthread.dylib 0x00000001f0824f20 _pthread_wqthread + 288
10 libsystem_pthread.dylib 0x00000001f0824fc0 start_wqthread + 8
)
This also happens in production apps like the Opal.
The questions are:
At least how to detect it to be able to manually reload the sheet (like what Opal does and shows an alert when this happens)
How to prevent it in the first place?
I really appreciate any help you can provide.
I am developing a parent child control app using Screen time API and Family Control. I created two apps, one for parent and another for child. I want to see child device's activity report on parent app. This functionality works when there is only one parent/organiser. I am trying to add multiple parents to access device activity report using screen time API. I created a family group where I am the organiser (Dad), added another account as parent (Mom) and two child accounts. On the child's device I installed the app, authorised the app for parental approval (Dad) and screen time restrictions. When using the parent app as Mom, I am unable to fetch the child device's activity report.
Hi,
Is there any way to force orientation = portrait when opening another shielded app?
Thanks!
I've been working with the Screen Time API for almost 6 months now.
I found out it's completely unreliable, testing on iOS 17.4, the DeviceActivityReport is not showing, the DeviceActivityMonitor more often than not does not fire intervalDidStart. It's very frustrating.
Has anyone found out a workaround?
We all know there has to be something we're doing wrong, since apps like Opal and Jono does not present those types of issues.
Let's please unite our forces and find a solution. How to use this API should not be a secret!
I'm looking to make an app using the ScreenTime API and the Managed Settings Framework. I'm experimenting with the FamilyActivityPicker, but when i open it from the simulator i see only categories with no applications.
Without being able to select applications, i cannot test properly the app.
I can't install it on a real device to test it because i do not have a paid Apple Developer account and therefore can't access the capability if i select my Free Developer Account in order to install it on my iPhone.
I am currently trying to build a prototype parental control app using the ScreenTime API.
I was just wondering if I needed to create a separate parent and child app?
Hi,
we are facing issues with the FamilyActivityPicker.
I have 2 devices in the same family, one successfully authorised as child device using AuthorizationCenter.shared.requestAuthorization(for: .child), the other one is used as parent device.
When I invoke FamilyActivityPicker on the children's device it works as expected but when invoked on the parent's device it only shows list of categories but not a single app. This behavior doesn't occur every time, on some devices it sometime works as it should.
It's very odd and I can't find any reason why it is happening. I would appreciate any tips.
Tested on app built with Xcode 15.3 an run on iOS 17.4.1 and iOS 16.7.2
I am building an app that manages ScreenTime and I would like to persist the tokens of which apps are frequently limited to CoreData locally. I attempted to do so by converting to a string but was unable to find a way to initialize an ActivityCategoryToken with a string.
Is this possible? Am I going about it the wrong way?
Thanks.
I currently have an app that is a companion app alongside the iOS app. I wonder if it is possible for me to make this app both a standalone and a companion app. Essentially if someone does not have an iphone they can still use the app. Is this possible?
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature.
It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me.
The problems I am facing are as follows:
When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability.
Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development).
I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps.
For more context, I have provided the relevant code snippet below:
import Flutter
import FamilyControls
import ManagedSettings
import SwiftUI
class FamilyActivityHandler: NSObject, FlutterPlugin {
// ...
private func openFamilyActivityPicker(result: @escaping FlutterResult) {
let store = ManagedSettingsStore()
let selection = FamilyActivitySelection()
// Adjusting for UIWindowScene for iOS 15 and later
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else {
result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil))
return
}
let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection)))
viewController.modalPresentationStyle = .formSheet
window.rootViewController?.present(viewController, animated: true, completion: nil)
DispatchQueue.main.async {
let applications = selection.applicationTokens
let categories = selection.categoryTokens
let webDomains = selection.webDomainTokens
store.shield.applications = applications.isEmpty ? nil : applications
store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())
store.shield.webDomains = webDomains
// Custom method to generate descriptive strings for tokens
let applicationsDescription = applications.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let categoriesDescription = categories.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let webDomainsDescription = webDomains.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let resultDict: [String: Any] = [
"applications": applicationsDescription,
"categories": categoriesDescription,
"webDomains": webDomainsDescription
]
result(resultDict)
}
}
}
I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels.
Thank you in advance for your help!
I am developing a parental control app using Flutter and platform channels to integrate with the Screen Time API on iOS. The app has two interfaces - one for the parent and one for the child. I have set up Family Sharing correctly and installed the app on both the parent's and child's devices. However, I am encountering some issues with the Family Activity Selection feature.
It's worth noting that I am a Flutter developer with limited knowledge of Swift and iOS development, so if my issues stem from a mistake I made, please forgive me.
The problems I am facing are as follows:
When calling the family activity selection, the list of apps shown in the apps sheet is from the parent's device, and no apps from the child's device are displayed. I have double-checked that Family Sharing and other necessary configurations are set up correctly, including the family control capability.
Even if I select apps on the parent's device, the selected apps are not returned in the result. The returned array is empty. Additionally, there is no close or done button on the sheet, and drag-to-dismiss is not working either. This might be an issue with the way I have written the code (most of the native code was generated by AI assistants like Claude and GPT, as I am a Flutter developer with limited knowledge of Swift and iOS development).
I have tested other parental control apps that use the Screen Time API and observed the same issue, where the parent's apps are shown on the parent's device instead of the child's apps.
For more context, I have provided the relevant code snippet below:
import Flutter
import FamilyControls
import ManagedSettings
import SwiftUI
class FamilyActivityHandler: NSObject, FlutterPlugin {
// ...
private func openFamilyActivityPicker(result: @escaping FlutterResult) {
let store = ManagedSettingsStore()
let selection = FamilyActivitySelection()
// Adjusting for UIWindowScene for iOS 15 and later
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else {
result(FlutterError(code: "NO_WINDOW_SCENE", message: "No window scene found", details: nil))
return
}
let viewController = UIHostingController(rootView: FamilyActivityPicker(selection: .constant(selection)))
viewController.modalPresentationStyle = .formSheet
window.rootViewController?.present(viewController, animated: true, completion: nil)
DispatchQueue.main.async {
let applications = selection.applicationTokens
let categories = selection.categoryTokens
let webDomains = selection.webDomainTokens
store.shield.applications = applications.isEmpty ? nil : applications
store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())
store.shield.webDomains = webDomains
// Custom method to generate descriptive strings for tokens
let applicationsDescription = applications.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let categoriesDescription = categories.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let webDomainsDescription = webDomains.map { token in
// Implement a custom description method or use an identifier property
"\(token)"
}
let resultDict: [String: Any] = [
"applications": applicationsDescription,
"categories": categoriesDescription,
"webDomains": webDomainsDescription
]
result(resultDict)
}
}
}
I would greatly appreciate any guidance or insights from the community on how to resolve these issues and properly implement the Family Activity Selection feature using the Screen Time API in a Flutter app with platform channels.
Thank you in advance for your help!