Meet the Screen Time API

RSS for tag

Discuss the WWDC21 session Meet the Screen Time API.

View Session

Posts under wwdc21-10123 tag

62 Posts
Sort by:
Post marked as solved
4 Replies
1.1k Views
Hello, Apple! Thanks for sharing Screen Time API! Together with my team we want to develop one cool app, that is based on parent-child relationship. Unfortunately, we couldn't understand completely how Screen Time API works according documentations. Could you please provide us a code example of Homework demo app or maybe guid us on what kind of steps we must do in order to get next functionalities: Block apps on child device until parent allow to access them. Listen what apps are running on child device. We need integrate backend part that way that child will be able to deserve by his own ability to use other apps for some time. Is it possible to make such functionality in background? Looking forward for your response! Best regards Dmitriy
Posted
by dimius555.
Last updated
.
Post not yet marked as solved
7 Replies
1.5k Views
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)")         }     } }
Posted
by rkotzy.
Last updated
.
Post not yet marked as solved
1 Replies
407 Views
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.
Posted
by LoguLogu.
Last updated
.
Post not yet marked as solved
1 Replies
445 Views
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.
Posted
by dimius555.
Last updated
.
Post not yet marked as solved
0 Replies
349 Views
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?
Posted
by vova085.
Last updated
.
Post not yet marked as solved
0 Replies
382 Views
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
Posted Last updated
.
Post marked as solved
2 Replies
652 Views
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.
Posted
by Rudraa.
Last updated
.
Post not yet marked as solved
0 Replies
220 Views
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
Posted
by yokai.
Last updated
.
Post not yet marked as solved
3 Replies
867 Views
Can you please make the sample code for the screen time api available?
Posted
by delray25.
Last updated
.
Post not yet marked as solved
1 Replies
560 Views
With the new iOS 15 screen time API, is it possible to get the usage history of apps or app categories? Like instead of just tracking the current usage within your newly added schedule, is there a way to see the average time spent on your phone for the past week/month/year like you can in settings?
Posted
by masonbk75.
Last updated
.
Post not yet marked as solved
0 Replies
357 Views
in order to block an app i need to have a bundle identifier for the app i want to block and then pass it to the Application constructor like this: Application(bundleIdentifier: "com.apple.calculator") then i can use it inside my app extension to block it in the case of shielding an app the situation is that i need the applicationToken which i tried to get from the Application object and transfer it to my app extension threw NSUserDefaults with no success. it seems that applicationToken value is unreachable and nil when i create an Application object. after this i tried to get an applicationToken of a selected app from the familyActivityPicker and i had success and managed to shield the app i selected. i did all of this on a child device only in a parent device the familyActivityPicker shows only categories and i cant figure out how the connection to the child apps in order to block or shield them will be made my questions are: is it possible to get applicationTokens not from the familyActivityPicker? how the parent app suppose to block an app on the child app without having any apps showing? how a parent app is "talking" with the child app exactly?
Posted
by vova085.
Last updated
.
Post not yet marked as solved
1 Replies
414 Views
i'm trying to make my app start blocking/shielding and app according to the selection from a familyActivityPicker. the problem that i'm having is that MyModel object is always nil when i'm accessing it inside the app extension. (DeviceActivityMonitor). can someone give me an example of the object he uses to get the applicationTokens in the app extension? an explanation on how to transfer information between the app and the app extension is also welcome.
Posted
by vova085.
Last updated
.
Post marked as solved
1 Replies
429 Views
I have tried to use Screen Time API. The problem is that I can't get access to FamilyControl framework on parent's device. What should I do to get access? class AppDelegate: NSObject, UIApplicationDelegate {        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {         AuthorizationCenter.shared.requestAuthorization { res in             switch res {             case .success():                 print("===SUCCESS AUTHORIZATION===")             case .failure(let error):                 print(error.localizedDescription)             }         }         return true     } }
Posted
by dimius555.
Last updated
.
Post not yet marked as solved
0 Replies
230 Views
So 2 bugs i have been finding with the screen time that really annoy me is that 1. why does the screen time on my phone go even when im not using it! My parent has set an hour on my phone every day and that hour goes while im at school and the timer should stop when i turn my phone off. And the 2nd thing is how do i fix my phone to turn off the screen time when changes have been made and they are not applying. My parent has turned off screen time and yet it is still on my phone and on the parents phone it says its disabled.
Posted Last updated
.