Meet the Screen Time API

RSS for tag

Discuss the WWDC21 session Meet the Screen Time API.

View Session

Posts under wwdc21-10123 tag

70 results found
Sort by:
Post not yet marked as solved
871 Views

Is it possible to request FamilyControls authorization on simulator?

I'm getting a FamilyControlsError Code=3 when requesting authorization from a simulator signed in with a child iCloud account. When requesting authorization from a simulator signed in with a parent iCloud account I receive the expected FamilyControlsError Code=2. There's not a lot of info on resolving these errors, and the code is pretty simple: func requestAuthorization() {     AuthorizationCenter.shared.requestAuthorization { result in         switch result {         case .success():             print("Sucess...")         case .failure(let error):             print("Failed... \(error)")         }     } }
Asked
by rkotzy.
Last updated
.
Post not yet marked as solved
50 Views

blocking and shielding on separate apps

is blocking and shielding can be done when the case is 2 completely separate apps one for the parent and one for the child and not one app that have 2 types of users (parent and child)?
Asked
by vova085.
Last updated
.
Post not yet marked as solved
350 Views

Can I manage restrictions from the parent's application?

I managed to achieve the list of children's applications on the parent device. But I can't manage restrictions for these applications. Is it only available from the child's device or there is a solution for the app management from the parent's app?
Asked
by yuraist.
Last updated
.
Post not yet marked as solved
134 Views

Event threshold callbacks are inconsistent

The event threshold callbacks are inconsistent. We receive the callback 30mins to 1hour late after scheduling or it stops coming suddenly. Is there any limit how many callbacks will be coming per hour or day? Sometimes I don't get the callback at all. Sometimes it works properly for the whole day(Same code without any change). Additional note: Sometimes I don't receive the schedule start call-back but the event threshold.
Asked
by LoguLogu.
Last updated
.
Post not yet marked as solved
172 Views

How does child can unblock apps for some period of time using Screen Time API?

I have created the app that uses Screen Time API (Device Activity, Managed Settings and Family Control). I have allowed on child device block and unblock apps that are selected in familyPicker, but I have to add ability to unblock these apps for some period of time. I have tried this:             do {                     center.stopMonitoring()                     try center.startMonitoring(.unblock, during: schedule, events: [.encouraged: DeviceActivityEvent(                         applications: applications.applicationTokens,                         threshold: DateComponents(second: 30)                     )])                     print("Unblock apps")                 } catch {                     print("Error")                 } Maybe I have to use another way to do it? but this doesn't work for me.
Asked
by dimius555.
Last updated
.
Post not yet marked as solved
176 Views

how can i have separate thresholds for different apps i selected?

i managed to shield app according to selection from the picker on the child app. i noticed that the threshold is for all the usage time of al the apps combined together. that means that if the threshold is 10 minutes and i used one of the selected apps 5 minutes and the other one for 5 minutes they both will be blocked. what i'm trying to do is that if each an app reached the threshold only it will be shielded anyone knows how to to this?
Asked
by vova085.
Last updated
.
Post not yet marked as solved
3.2k Views

Is the Screen Time API completely broken in the betas?

I've been trying to get something to work with the Screen Time API, but almost everything related to it is completely and truly broken/unimplemented. I've tried all of this in the iOS 15 Beta 2 and 3 and Xcode 13 Beta 2 and 3. These are just a handful of the bugs I came across: Screen Time APIs do not work on the simulator. Calling AuthorizationCenter.shared.requestAuthorization on a simulator with a logged in child account always results in "FamilyControls.FamilyControlsError Code=3" FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. It's not clear at this point whether FamilyActivityPicker needs to be called on the parent or the child device. Assuming restrictions can actually be set, there is no API to allow setting up of restrictions for individual kids. After successfully authorizing a child device via AuthorizationCenter.shared.requestAuthorization, DeviceActivityCenter.startMonitoring always results in an MonitoringError.unauthorized error. AuthorizationCenter.requestAuthorization error in callback cannot be mapped back to FamilyControlsError because it is a plain NSError with an error code and FamilyControlsError does not expose an initialiser that takes a rawValue. Even though an app is authorized to managed ScreenTime on a child device, the child can always just delete the app. (I would try to submit a bug with device diagnostics about this using Feedback Assistant, but to top it all off at the moment I am receiving an error in FA that says "Unable to gather diagnostics" / "A problem was encountered when trying to gather diagnostics. Try gathering diagnostics again"). There's no device activity / shield configuration or shield action extension templates in Xcode. For those wondering, I created a CallDirectory extension and then changed the NSExtensionPointIdentifier in the plist to the appropriate value. What is the appropriate value? It's not mentioned in the documentation :), so I had to dig around in the Xcode support files to find out the following identifiers: com.apple.ManagedSettings.shield-action-service com.apple.ManagedSettingsUI.shield-configuration-service com.apple.deviceactivity.monitor-extension And this leads me to my last item: the documentation which is absolutely lacking. There is no programming guide for the frameworks and the Homework app we saw developed during WWDC is not available. It's not clear how the settings from the guardian app get applied to the child app. Is there a built-in mechanism or do we need to use our own implementation to transfer those changes (via push or whatever)? Of course I reported almost all of this via Feedback Assistant, but considering I had previous feedback for other APIs sit there untouched for years in the past, it's really frustrating and it feels like I'm just talking to myself with those bug reports. So, did I do something wrong and completely misinterpreted the capabilities and functionality of the ScreenTime API or is it truly broken and non-functional in iOS 15 Beta 2/3? There's absolutely no mention of these issues in the release notes so I am starting to question my sanity here.
Asked
by clawoo.
Last updated
.
Post not yet marked as solved
181 Views

Screen Time API FamilyActivityPicker

There are 2 types of login in the application one for Parents and one for Children. Once the parent has signed up and set his profile, then he will be able to add multiple students. Students will be able to log in to the app using the QA code provided by the parent. Once the students have logged in successfully, the Parent can set their restrictions that which applications to be restricted for use. The parent can add scheduled prompts for specific students in terms of hourly, daily, weekly, and monthly. Once the scheduled prompt arrives on the student’s device in terms of notification. The student's device-restricted apps will be locked for a specific amount of time. The student is allowed to complete a subject questionnaire to unlock their device. For eg, there will be a list of 5 questions with multiple options to choose from. If the student gives a minimum of 4 right answers the student’s device will be unlocked or it will be locked for 5 minutes if the count of the correct answers is less than 4. After the 5 minutes [Specific time - predefined] are complete, the student's device will be unlocked. We also created Apple ID for parents and children from family sharing documentation for screen time API. We also implemented authentication functionality with help of the family controls framework after approval we called FamilyActivityPicker as per provided document on family controls we got a view of all categories list but we were unable to see the application list on which depending on their category How we lock all applications depending on he got remote notification in student device  Mac OS:- Bigsur (11.4) System:- Mac mini(M1,2020) Chip:- Apple M1 Memory:- 16GB XCode:- 13
Asked Last updated
.
Post marked as solved
293 Views

shielding and blocking apps

i'm trying to shield and block apps on child device. i managed to block apps by creating a  variable blockedApps : Set = Set() that contains a list of applications like Application(bundleIdentifier: "com.apple.calculator") inside the intervalDidStart on my DeviceActivityMonitor extension now i'm trying to shield an app using the same extension and nothing happens. for this i used this code inside intervalDidStart:   let calculatorApp = Application(bundleIdentifier: "com.apple.calculator")     var blockedApps : Set = Set()           guard let token = calculatorApp.token else {       return     }     blockedApps = [token]     store.shield.applications = blockedApps and i cant tell what is the reason for this not working is there a token issue that is nil? does shielding requires a different app extension? does my app extension requires some additional configuration maybe a different NSExtensionPointIdentifier?
Asked
by vova085.
Last updated
.
Post marked as solved
413 Views

Not getting call back to DeviceActivityMonitor extension

Hi, Problem: Even after successful schedule creation I am not getting call backs(intervalDidStart, intervalDidEnd) to my extension I have created DeviceActivityMonitor extension by creating call Directory Extension and updated info plist with the value (com.apple.deviceactivity.monitor-extension) and updated principal class value too. I try running the extension on my demo app which has the below code,         let schedule = DeviceActivitySchedule(             intervalStart: DateComponents(hour: 10, minute: 30),             intervalEnd: DateComponents(hour: 12, minute: 15),             repeats: true,             warningTime: nil)         do {             let center = DeviceActivityCenter()             center.stopMonitoring([.daily])             try center.startMonitoring(.daily, during: schedule)             print("Schedule created")             print(center.activities)         } catch {             print(error)         }     } My extension has the below code, override func intervalDidStart(for activity: DeviceActivityName) {         super.intervalDidStart(for: activity)         print("Entered Did Start")     }     override func intervalDidEnd(for activity: DeviceActivityName) {         super.intervalDidEnd(for: activity)         print("Entered Did End")     } Please guide me to find out the issue. Thanks in advance.
Asked
by Rudraa.
Last updated
.
Post not yet marked as solved
690 Views

Screen Time Guardian App Questions

WWDC21 session 10123 shows a screen that implies the guardian instance of your app is able to select apps on your child's device to encourage or to control. In my experience with the API so far I can't see a way to do this. The API only seems to work on the child's phone. Here are my questions: Is there a suggested way to determine whether the app is running on a guardian device? The only way I can see is to attempt AuthorizationCenter.shared.requestAuthorization and check for an error value of .invalidAccountType. But it seems you could get that error for other reasons too. Is there a way to present FamilyActivityPicker on the guardian device but have it show apps on the child's phone? I don't see any thing in the API for selecting a child account to access with `FamilyActivityPicker', it seems to only show the phone's user's apps (or no apps if it's the guardian's phone). After retrieving app tokens from 'FamilyActivityPicker' is there a recommended way to present to the user in the UI? The WWDC session shows an app icon and app name (i.e. "Books" and "Solar System"), but my understanding is that info is hidden from the developer for privacy reasons. So I'm wondering if the example in the session is really feasible.
Asked
by pinch.
Last updated
.
Post not yet marked as solved
105 Views

I can't access the kid's device control data through ScreenTimeApi

I authorized the kid-side device, and the kid-side device can get the corresponding data and control through familyActivityPicker. However, the parent side cannot get the kid-side control data, even though we are already in the same family group
Asked
by yokai.
Last updated
.
Post not yet marked as solved
681 Views

Sample code

Can you please make the sample code for the screen time api available?
Asked
by delray25.
Last updated
.