Screen Time

RSS for tag

Share and manage web-usage data, and observe changes made to Screen Time settings by a parent or guardian.

Screen Time Documentation

Posts under Screen Time tag

149 Posts
Sort by:
Post not yet marked as solved
0 Replies
757 Views
I am trying to understand how much I can do with shield actions, if anything. So at its basic, the shield action has 3 options, none, defer, and close. I believe defer is used to rebuild the shield if needed (for example, a parent allowing their child to open the app). Can this be used as a button to just straight up bypass the shield? Like if a user taps button one, it would run shield action close, if taps button two, it would bypass the shield and open the app? If so, how would one bypass since t he handler requires the shield action options? override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) { switch action { case .primaryButtonPressed: completionHandler(.close) case .secondaryButtonPressed: completionHandler(.defer) @unknown default: fatalError() } }
Posted
by
Post not yet marked as solved
1 Replies
654 Views
Hello Apple Developer Community, I am currently exploring the Screen Time API and its potential for creating a parental control-style application. However, I have a slightly different use case in mind that I need some guidance on. I am wondering if it is possible to use the Screen Time API to create a monitoring application for a consenting adult, instead of the traditional parent-child scenario provided by the Family Sharing setup. For example, if a friend of mine wants to apply an internet filter on their iPhone and have me monitor it, can I create an app to do so? To elaborate, I'm envisioning a setup similar to how the 'Find My Friends' app allows us to locate our friends (who are not necessarily a part of our family) after obtaining their consent. Is it possible to leverage the capabilities of the Screen Time API to create a 'monitoring' app on my device that can track and control aspects of my friend's device usage without having to engage the Family Sharing and Family Controls frameworks? I understand that privacy and consent are paramount in such a situation, but this is a scenario between two consenting adults. This is purely for the purpose of assisting my friend in managing their digital habits more effectively. I appreciate any insights or advice that the community can provide on this topic. Thank you in advance!
Posted
by
Post not yet marked as solved
2 Replies
606 Views
Hi I want to use the new iOS 16 Screen time API to show a block page over Safari and Chrome when the user enters an "adult-content" page like a gun store, allowing it to continue searching on the internet if the user wants. Any tips on how to do this? Thanks in advance
Posted
by
Post not yet marked as solved
0 Replies
442 Views
Hi: Is there any way to know if the user has screen time enabled? Thanks in advance
Posted
by
Post not yet marked as solved
0 Replies
545 Views
I'm trying to populate DeviceActivityReportScene from DeviceActivityData. I have a list of custom objects of type 'DailyLimit' and I want to create separate instances of 'DeviceActivityReportScene' for each item inside the array. The following code works. This creates two separate instances of DeviceActivityReportScene for the item 0 and item 1 in the array. @main struct ReportingExtension: DeviceActivityReportExtension { let limits = Store.shared.getDailyLimits() var body: some DeviceActivityReportScene { DailyLimitActivityReport(dailyLimit: limits[0], context: DeviceActivityReport.Context(rawValue: limits[0].id)) { report in DailyLimitActivityView(activityReport: report) } DailyLimitActivityReport(dailyLimit: limits[1], context: DeviceActivityReport.Context(rawValue: limits[1].id)) { report in DailyLimitActivityView(activityReport: report) } } } struct DailyLimitActivityReport: DeviceActivityReportScene { let dailyLimit: DailyLimit let context: DeviceActivityReport.Context let content: (ActivityReport) -> DailyLimitActivityView func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> ActivityReport { ... } } But I want to create the list of DeviceActivityReportScene dynamically like the following. @main struct ReportingExtension: DeviceActivityReportExtension { let limits = Store.shared.getDailyLimits() var body: some DeviceActivityReportScene { ForEach(limits) { limit in DailyLimitActivityReport(dailyLimit: limit, context: DeviceActivityReport.Context(rawValue: limit.id)) { report in DailyLimitActivityView(activityReport: report) } } } } But this throws an error 'No exact matches in reference to static method 'buildExpression' Any ideas to fix this issue will be highly appreciated & thanks in advance.
Posted
by
Post not yet marked as solved
3 Replies
1.9k Views
A few days ago, I upgraded my phone to iOS 17 and have since encountered a serious issue with my app, which heavily uses the Screen Time API. Randomly throughout the day, the Screen Time connection breaks. As a result, all device activity reports turn up empty and the device activity center stops tracking activities. This problem doesn't only affect my app, but also all others that have Screen Time permissions on my phone. The only workaround I've found is to switch off and then switch on the Screen Time permission again. This issue is clearly a significant concern for all developers working with the Screen Time API. I've submitted a bug report (FB12332405), but I can't dig deeper into the problem because I'm stuck on this: https://developer.apple.com/forums/thread/731010. Has anyone else come across this issue since upgrading to iOS 17?
Posted
by
Post not yet marked as solved
0 Replies
803 Views
Whenever a user focuses a textfield inside the view provided a device activity report extension, the extension crashes in iOS 17 (21A5248v). This worked flawlessly in iOS 16. I've submitted a bug report (FB12270432), but I can't dig deeper into the problem because I'm stuck on this: https://developer.apple.com/forums/thread/731010. Has anyone else come across this issue since upgrading to iOS 17?
Posted
by
Post not yet marked as solved
0 Replies
378 Views
Is there a way to allow blocking "only" social media apps using the FamilyActivityPicker? I assume the current standard way of app-blocker apps are, Users allow the use of ScreenTime API Users freely choose the apps they want to block via the Picker list Users press the start button Selected apps blocked What I want to achieve is either the below: Users allow the use of ScreenTime API Users press the start button Social media apps blocked (※ Apps pre-selected by the admin) or, as a workaround, Users allow the use of ScreenTime API Users choose the apps they want to block via the Picker list, but they are only allowed to select social media apps. Users press the start button Social media apps blocked
Posted
by
Post not yet marked as solved
6 Replies
1.2k Views
Our app uses Cordova with a Cordova Local Webserver plugin. This plugin uses the url http://localhost: with a randomly chosen port. Some of the devices that our app runs on are MDM configured and have Content Filters enabled which only allows a finite list of website URLs to be accessed. This configuration has always worked in the past. Starting with the release of iPadOS 16.5, our app now hangs because the content filters are now preventing access to http://localhost. We've tried adding http://localhost, plus any derivative of that URL (i.e. http://localhost:, http://localhost:*, etc.) to the Allowed Website list, but this does not help. Wondering if anyone else has encountered this issue.
Posted
by
Post not yet marked as solved
0 Replies
490 Views
I am using Managed Settings to block all apps during a set period of time using the below method. override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) ManagedSettingsStore().shield.applicationCategories = .all() } When a user opens an app during that time, they should be allowed to press a button on the shield which lets them "continue using that app", just like the default iOS screen time allows for. However, this doesn't seem possible right now when the below delegate is called for ActivityCategoryToken ShieldAction: override func handle(action: ShieldAction, for category: ActivityCategoryToken, completionHandler: @escaping (ShieldActionResponse) -> Void) { switch action { case .primaryButtonPressed: completionHandler(.close) case .secondaryButtonPressed: ManagedSettingsStore().shield.applicationCategories = .all(except: category) //this is not possible right now. completionHandler(.none) @unknown default: fatalError() } } This is because the .all(except:) method takes a set of application tokens, but the handle delegate method on activityCategoryTokens only provides application category tokens. Is there no way to get around this? It would be very helpful if either a) the delegate method for ActivityCategoryToken ShieldAction also provided the ApplicationToken that was blocked (this would be preferred), or b) the .all(except: ) method also accepts ActivityCategoryTokens as an input.
Posted
by
Post not yet marked as solved
0 Replies
392 Views
Currently, FamilyActivity labels rendered with Label(ApplicationToken) seem to have no way to respect a .preferredColorscheme(.dark/.light). The token appearance seems coerced to the system setting rather than the app preference. This results in tokens being arbitrarily invisible according to combinations of app and system colorscheme preferences. For example, if the user has set dark mode and SwiftUI sets .preferredColorscheme(.light), both the view background and label text will be white. (Conversely, with a combination of system light mode and view .preferredColorscheme(.black), both the view background and label text is be black). Is there any way to get a Label(ApplicationToken) to respect the application's preferredColorScheme?
Posted
by
Post not yet marked as solved
0 Replies
391 Views
I want to control child device from parent device using ScreenTime API's. [Question 1] On the child device, after successive requestAuthorization calls. On the parent device, do we have to call requestAuthorization(for .child) for a certain internal operation of Screen Time API that we don't know, even though it returns an error message ? Requesting authorization on the parent side does not seem to be necessary, however, we want to make them clear. [Question 2] To support Screen Time API's operation properly, what iOS version do we have to set for the minimum deployment target in XCode project ? According to the updates and changes of iOS version releases in the below site, iOS 16 and iOS 16.5 have Screen Time API related updates respectively. https://support.apple.com/en-hk/HT213407 Definitely the latest updated version is better than older one but how about iOS 16 as minimum deployment target?
Posted
by
Post not yet marked as solved
0 Replies
365 Views
[Question] How long will it take to make application token available after Screen time API's authorization approval on child device and parent app's first launch and the first FamilyActivityPicker's request? Is it normal for parent app to wait for about half of day? If so, is there any way to reduce its delay? (not sure but for example, subscribe an additional Apple service such like iCloud+ paid service to shorten waiting time) [Reproduction] Completes Family sharing set-up between the child device and the parent device. Authorization related statements executed like below on the child device. AuthorizationCenter.shared.requestAuthorization(for: .child) and then Screen Time API has been activated in the child device through some permission related pop-up windows such as parent's Apple ID input pop-up. Skips calling authorization related statements like below, cause it may be not effective in parent device, // AuthorizationCenter.shared.requestAuthorization(for: .child) AuthorizationCenter.shared.authorizationStatus returns ".notDetermined" which means the app hasn’t requested authorization. When FamilyActivityPicker opened, it shows the application list of the child device on the parent device remotely. Selects a few of child's applications from the FamilyActivityPicker View. When picker view closed, all of the internel variables of its connected object of FamilyActivitySelection class are empty. Picker doesn't provide an array of ApplicationToken for the selected applications. After a little more than 12 hours, when I tried above procedures again, the object of FamilyActivitySelection has been filled with proper application tokens finally. And also, since then, FamilyActivityPicker has provided application tokens without fail anymore. [Test devices] iPhone 13 Pro (iOS 16.5) for child iPhone 11 Pro (iOS 16.5) for parent [Additional explanation] Whenever tried the above reproduction procedures with differrent devices and different icloud accounts but with the same application bundle id, it commonly took a very long time (about half of day) to receive application tokens successfully.
Posted
by
Post not yet marked as solved
0 Replies
330 Views
[Question] Sometimes, Device Activity Report Extension provides duplicated values in DeviceActivityResults, we want to know why those duplicated DeviceActivityResults values exist? Is the value of DeviceActivityResults dependent on the setting of the function call to DeviceActivityCenter().startMonitoring?
Posted
by
Post not yet marked as solved
0 Replies
250 Views
On the parent device, to use Screen Time API properly, at first we need to turn off Settings's own Screen Time so that Screen Time API does not conflict with pre-existing system Screen Time. How to know programmatically whether the parent device's Settings's Screen Time has already been activated or not (ON or OFF) ?, and also, if it's ON, how to make it turn off programmatically ?
Posted
by
Post not yet marked as solved
0 Replies
374 Views
We want to include Screen Time API access codes in not only main app (container app) but also app extension such like Location Push Service Extension or Widget Extension. On app extension side, are there any restrictions to create and use objects of below classes in either cases , main app is running or not running ? ManagedSettingsStore DeviceActivitySchedule DeviceActivityCenter and also, do they do the same thing that works on the main app side like below ? shield application create a device activity schedule startMonitoring
Posted
by
Post not yet marked as solved
3 Replies
753 Views
We persist ApplicationTokens in a storage container that ShieldConfigurationExtension has access to. In rare, cases all the ApplicationTokens for a user seem to change. We know this because the Application parameter passed into configuration(shielding application: Application) -> ShieldConfiguration function has a Token that does not match (using == ) any of the ones we are persisting in storage. Interestingly, the persisted ones still work, so I don't believe storage has gotten corrupted or anything. We can use them to add or remove shields, we can use them to display labels of the apps they represent, etc. But they don’t match what’s passed into the ShieldConfiguration extension. If the user goes into the FamilyPicker at this point and selects an app of a token that we are already persisting, the FamilyPickerSelection will have a token matching the new one that is passed into ShieldConfigurationExtension, not the one we persisted when they last selected that app. This leads me to believe the tokens are updated/rotated in some cases. When and why does this happen, and how can we handle it gracefully?
Posted
by
Post not yet marked as solved
0 Replies
345 Views
I would like to know how the "App Limits" feature in Screen Time of the iOS system is developed, which limits the duration of app usage within a day rather than specific time periods. The during parameter in the startMonitoring method of DeviceActivityCenter is a DeviceActivitySchedule object that allows you to control the start and end times of monitoring activities. However, it does not provide a direct way to set the duration of the monitoring. Instead, it focuses on defining the time interval during which the monitoring should occur.
Posted
by
Post not yet marked as solved
1 Replies
512 Views
Hello! I'm currently making an app that involves the Screen Time API. I have the required entitlements and capabilities added, both in Xcode and the developer portal, and I've requested, got, and enabled the Family Controls (Distribution) entitlement. I am using requestAuthorization(for: .individual) for the API. I'm encountering a problem with the shield settings within ManagedSettingsStore, I can't seem to have the store shield over 50 apps (app tokens) or 50 websites (web tokens). If I assign store.shield.applications or store.shield.webDomains with over 50 items each, then the store will not shield any items and calling these variables returns nil for both. I am using ManagedSettingsStore(named: _) and I have 12 ManagedSettingsStore.Name items in total. As long as there are 50 apps and/or 50 websites under any shield, or combined from multiple shields, then no other shields from other stores will be able to shield apps or websites. I can't seem to find information about this online, and I'm thinking that I'm likely using the API wrong. I encountered this both on iOS 16 and the iOS 17 betas, and Xcode 14.3+ and the Xcode 15 betas. (I did not start the project until Xcode 14.3 was released) Thanks.
Posted
by