Search results for

“DeviceActivityReport”

135 results found

Post

Replies

Boosts

Views

Activity

Reply to I could not show Device Activity Report in my App
I enabled Screen Time in parent, for monitoring child devices uses. In order to report child usage on a parent's device, you must ensure that your app is properly entitled and authorized for Family Controls on the child devices using an AuthorizationCenter. The question is How can I show usage of the apps in my App with customized SwiftUI views? as I said I did lots of suggestions but I could not implemented. If you click File > New > Target... > iOS > Device Activity Report Extension in Xcode, it will create a simple Device Activity Report extension. Then, your app can create a DeviceActivityReport with a DeviceActivityFilter that specifies activity data for .children. Your extension will then be provided the data for the parent's children and can use this data to render the contents of the report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Is Screen Time trapped inside DeviceActivityReport on purpose?
[quote='817516021, Melwin, /thread/817516, /profile/Melwin'] Is Screen Time trapped inside DeviceActivityReport on purpose? [/quote] Yes. Some app extensions handle extremely sensitive data that shouldn’t leave the device. The system runs such appexen in a read-only sandbox, so that the appex can’t export that sensitive data to other code with a less restrictive sandbox. I’m more familiar with this idea in the context of Network Extension content filters, where the docs clearly explain this concept. However, I’ve seen the same technology used for numerous other appex types, and it certainly looks like this includes Device Activity report extensions. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Privacy & Security SubTopic: General Tags:
Mar ’26
Reply to DeviceActivityReport fails to display SceneView
Hello, thanks for your response. Since I first posted, I discovered I can get the scene to render within the iPhone simulator on my mac, but not on my physical iPhone. However, the scene renders fine on my phone when it is in the main app and not within the DeviceActivityReportExtension, so I don't think it's a hardware issue with my phone. Here is my DeviceActivityReportExtension containing my DeviceActivityReportScene. import DeviceActivity import SwiftUI @main struct TestActivityReport: DeviceActivityReportExtension { var body: some DeviceActivityReportScene { TotalActivityReport { totalActivity in TotalActivityView(totalActivity: totalActivity) } } } Here is how I am calling the extension from the main app struct ContentView: View let context = DeviceActivityReport.Context.totalActivity let now = Date() let oneWeekAgo = Calendar.current.date(byAdding: .day, value: -7, to: Date())! var body: some View { DeviceActivityReport(context, filter: DeviceActivityFilter(segment: .daily(during: DateInterval
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to DeviceActivityReport extension not discovered at runtime (ClientError Code=2)
Hi Thanks a lot for your previous hint — it helped me fix the bundle setup. I now have the following confirmed: The report extension is correctly embedded under: Work4Fun.app/Extensions/UsageReportExtension.appex Info.plist uses: EXAppExtensionAttributes → EXExtensionPointIdentifier = com.apple.deviceactivityui.report-extension Entitlements include: com.apple.developer.family-controls com.apple.developer.family-controls.app-and-website-usage App Group The compiled binary clearly contains my code (UsageReportExtension.init, makeConfiguration, etc.) However, at runtime: DeviceActivityReport is instantiated (I see my view appear) System logs show: Plugin query method called But the extension is never actually executed: no init no makeConfiguration no output file written in App Group I also tried: deleting the app rebooting the device reinstalling from Xcode re-authorizing Screen Time → same result So it looks like: → iOS resolves the extension, but does not launch it Have you seen this behavior before?
Topic: App & System Services SubTopic: General Tags:
Apr ’26
Reply to DeviceActivityReport not showing report data to main app
I am getting the exact same error! Not sure how I am failing to grant permission in my main app as well. I even checked with print statements in my code to see if the Screen Time Authorization status was approved like this - print(Screen Time Authorization Status (authorizationStatus)) This was the full error when I attempted to run DeviceActivityReport(appsConext, filter: filter) -- LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 process may not map database UserInfo={NSDebugDescription=process may not map database, _LSLine=68, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Attempt to map database failed: permission was denied. This attempt will not be retried. Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 process may not map database UserInfo={NSDebugDescription=process may not map database, _LSLine=68, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
Topic: App & System Services SubTopic: General Tags:
Dec ’24
How to force update data from child phone ? FamilyControls / Screen Time Api / DeviceActivity
The data displayed about a child’s apps can be outdated (DeviceActivityReport), leading to misinformation for the user. When I access the “Screen Time” section (for child in the parent device) in the iPhone settings, I see there is an update functionality to force load the actual data. I have tried various workarounds, such as attempting to force an update on the child’s device to call DeviceActivityReport and opening system settings, but none of these have been successful :( How can I implement something similar? Is there a way to force update this data ?
0
0
555
Nov ’24
Device activity report data View is hidding when change the tab
I am working on the device activity report. and fetched data is loading on the chart. I am developing app using TabbarController. when I go to another tab and come back to the chart screen, it disappears. Here, I am working on a storyboard using Swift language, and device activity reports can be fetched only with SwiftUI. So, the problem is with it? Following the current code. @State private var context: DeviceActivityReport.Context = .init(rawValue: Daily Activity) @State private var report: DeviceActivityReport? @State private var filter = DeviceActivityFilter( segment: .daily( during: Calendar.current.dateInterval( of: .day, for: .now )! ) // users: .all // devices: .init([.iPhone, .iPad]) ) @State var isReload: Bool = false var body: some View { ZStack { if isReload { LoadingView(title: Data is loading...) } else if let report = report { report } else { DeviceActivityReport(context, filter: filter) } } .onAppear { DispatchQueue.main.async { report = DeviceActivityReport(context,
0
0
690
Nov ’24
How to Filter App Usage for a Specific Time Period Using Screen Time API?
I am working on a SwiftUI app using the Screen Time API and the DeviceActivityReport view to display app usage data. My current implementation successfully shows daily app usage using a DeviceActivityFilter with the .daily(during:) segment. However, I need to filter this data to show app usage only for a specific time period during the day, e.g., 4:00 PM to 5:00 PM. I created a DeviceActivityFilter with a .daily(during:) segment and passed a DateInterval for the desired time range: let now = Date() let startTime = calendar.date(bySettingHour: 16, minute: 0, second: 0, of: now)! let endTime = calendar.date(bySettingHour: 17, minute: 0, second: 0, of: now)! let timeInterval = DateInterval(start: startTime, end: endTime) let filter = DeviceActivityFilter( segment: .daily(during: timeInterval), users: .all, devices: .init([.iPhone]) ) I applied this filter to the DeviceActivityReport view: DeviceActivityReport(context, filter: filter) Even with the DateInterval set for the specific time
0
0
493
Dec ’24
HELP ScreenTime API DeviceAcivityReport continious issues
Hi everyone, I've been spending my evenings on the app for around 6 months that's using Screen Time API introduced in WWDC 21 (https://developer.apple.com/videos/play/wwdc2021/10123/), I'm having many issues with this API and looking for anyone who has experience with this API, I will appreciate any help or advice I can get! I'm using DeviceActivityReport to display the dashboard with screen time usage and certain metrics. Device activity report extension runs in an isolated sandbox, which makes it harder to debug and can't make any network call or write to any storage, for privacy purposes which makes sense, but makes it very hard for development. The issue is that the process where DeviceActivityReport is running crashes for no reason frequently or doesn't run at all. The API itself has many bugs, which is backed up by my experience, Opal app developers and Screen Time even made the news with its bugs. I see the same behaviour with other apps like Opal, but they can workaround somehow it a
2
0
1.8k
Nov ’23
Device Activity Report: Resolving 'Context' Type Issue in TotalActivityReport.swift
Hello Apple Developers, I've encountered an issue while working on a DeviceActivityReport in Swift. The problem arises when attempting to use the Context type from DeviceActivityReport. Here is the snippet of the code causing the problem: import DeviceActivity import SwiftUI extension DeviceActivityReport.Context { // If your app initializes a DeviceActivityReport with this context, then the system will use // your extension's corresponding DeviceActivityReportScene to render the contents of the // report. static let totalActivity = Self(Total Activity) } struct TotalActivityReport: DeviceActivityReportScene { // Define which context your scene will represent. let context: DeviceActivityReport.Context = .totalActivity // Define the custom configuration and the resulting view for this report. let content: (String) -> TotalActivityView func makeConfiguration(representing data: DeviceActivityResults) async -> String { // Reformat the data into a configuration that can be used to
2
0
885
Aug ’24
Family control app uploading error
/Users/varunashokbhaisidpara/Desktop/Screenshot 2024-11-15 at 5.43.44 PM.png This error occurs When I try to upload an app on the test flight or App Store. I checked Automatically manage signing in the main target. and i have added extensions DeviceActivityMonitorExtension, ShieldConfigurationExtension, ShieldActionExtension, DeviceActivityReport. and all have selected Automatically manage signing in the target > signing and capability. pls provide me with an exact solution set by step. Thank you
3
0
890
Nov ’24
Screen Time API - Device Activity Report
I need some assistance with the Screen Time API’s DeviceActivityReport extension. I know the extension is sandboxed but I need the data inside my app. Jomo is currently doing this so it’s not impossible. I see they’re saying it’s an estimate which is about 5 - 10 off of the actual screen time, but how are they doing this? Any attempt to store the screen time data inside some sort of database or UserDefaults always fails of course due to the sandbox. Any advice would be greatly appreciated!
0
0
501
Oct ’24
Reply to I could not show Device Activity Report in my App
I enabled Screen Time in parent, for monitoring child devices uses. In order to report child usage on a parent's device, you must ensure that your app is properly entitled and authorized for Family Controls on the child devices using an AuthorizationCenter. The question is How can I show usage of the apps in my App with customized SwiftUI views? as I said I did lots of suggestions but I could not implemented. If you click File > New > Target... > iOS > Device Activity Report Extension in Xcode, it will create a simple Device Activity Report extension. Then, your app can create a DeviceActivityReport with a DeviceActivityFilter that specifies activity data for .children. Your extension will then be provided the data for the parent's children and can use this data to render the contents of the report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’22
Reply to Is Screen Time trapped inside DeviceActivityReport on purpose?
[quote='817516021, Melwin, /thread/817516, /profile/Melwin'] Is Screen Time trapped inside DeviceActivityReport on purpose? [/quote] Yes. Some app extensions handle extremely sensitive data that shouldn’t leave the device. The system runs such appexen in a read-only sandbox, so that the appex can’t export that sensitive data to other code with a less restrictive sandbox. I’m more familiar with this idea in the context of Network Extension content filters, where the docs clearly explain this concept. However, I’ve seen the same technology used for numerous other appex types, and it certainly looks like this includes Device Activity report extensions. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’26
Reply to DeviceActivityReport fails to display SceneView
Hello, thanks for your response. Since I first posted, I discovered I can get the scene to render within the iPhone simulator on my mac, but not on my physical iPhone. However, the scene renders fine on my phone when it is in the main app and not within the DeviceActivityReportExtension, so I don't think it's a hardware issue with my phone. Here is my DeviceActivityReportExtension containing my DeviceActivityReportScene. import DeviceActivity import SwiftUI @main struct TestActivityReport: DeviceActivityReportExtension { var body: some DeviceActivityReportScene { TotalActivityReport { totalActivity in TotalActivityView(totalActivity: totalActivity) } } } Here is how I am calling the extension from the main app struct ContentView: View let context = DeviceActivityReport.Context.totalActivity let now = Date() let oneWeekAgo = Calendar.current.date(byAdding: .day, value: -7, to: Date())! var body: some View { DeviceActivityReport(context, filter: DeviceActivityFilter(segment: .daily(during: DateInterval
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to DeviceActivityReport extension not discovered at runtime (ClientError Code=2)
Hi Thanks a lot for your previous hint — it helped me fix the bundle setup. I now have the following confirmed: The report extension is correctly embedded under: Work4Fun.app/Extensions/UsageReportExtension.appex Info.plist uses: EXAppExtensionAttributes → EXExtensionPointIdentifier = com.apple.deviceactivityui.report-extension Entitlements include: com.apple.developer.family-controls com.apple.developer.family-controls.app-and-website-usage App Group The compiled binary clearly contains my code (UsageReportExtension.init, makeConfiguration, etc.) However, at runtime: DeviceActivityReport is instantiated (I see my view appear) System logs show: Plugin query method called But the extension is never actually executed: no init no makeConfiguration no output file written in App Group I also tried: deleting the app rebooting the device reinstalling from Xcode re-authorizing Screen Time → same result So it looks like: → iOS resolves the extension, but does not launch it Have you seen this behavior before?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’26
Reply to DeviceActivityReport not showing report data to main app
I am getting the exact same error! Not sure how I am failing to grant permission in my main app as well. I even checked with print statements in my code to see if the Screen Time Authorization status was approved like this - print(Screen Time Authorization Status (authorizationStatus)) This was the full error when I attempted to run DeviceActivityReport(appsConext, filter: filter) -- LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 process may not map database UserInfo={NSDebugDescription=process may not map database, _LSLine=68, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} Attempt to map database failed: permission was denied. This attempt will not be retried. Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 process may not map database UserInfo={NSDebugDescription=process may not map database, _LSLine=68, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
How to force update data from child phone ? FamilyControls / Screen Time Api / DeviceActivity
The data displayed about a child’s apps can be outdated (DeviceActivityReport), leading to misinformation for the user. When I access the “Screen Time” section (for child in the parent device) in the iPhone settings, I see there is an update functionality to force load the actual data. I have tried various workarounds, such as attempting to force an update on the child’s device to call DeviceActivityReport and opening system settings, but none of these have been successful :( How can I implement something similar? Is there a way to force update this data ?
Replies
0
Boosts
0
Views
555
Activity
Nov ’24
DeviceActivityReportExtension view does not appear on certain device.
DeviceActivityReport Extension view does not appear on certain devices. iPhone14 Promax - 16.0.3 Other devices appear normally. Are there any restrictions such as unsupported versions or devices?
Replies
0
Boosts
0
Views
480
Activity
Jun ’23
Cannot access to screentime database to show in UI
I am getting this error when I try to show device activity report view by this DeviceActivityReport(appsContext, filter: filter) Attempt to map database failed: permission was denied. This attempt will not be retried. I have taken access by this way. AuthorizationCenter.shared.requestAuthorization(for: .individual)
Replies
0
Boosts
0
Views
397
Activity
Jan ’26
Device activity report data View is hidding when change the tab
I am working on the device activity report. and fetched data is loading on the chart. I am developing app using TabbarController. when I go to another tab and come back to the chart screen, it disappears. Here, I am working on a storyboard using Swift language, and device activity reports can be fetched only with SwiftUI. So, the problem is with it? Following the current code. @State private var context: DeviceActivityReport.Context = .init(rawValue: Daily Activity) @State private var report: DeviceActivityReport? @State private var filter = DeviceActivityFilter( segment: .daily( during: Calendar.current.dateInterval( of: .day, for: .now )! ) // users: .all // devices: .init([.iPhone, .iPad]) ) @State var isReload: Bool = false var body: some View { ZStack { if isReload { LoadingView(title: Data is loading...) } else if let report = report { report } else { DeviceActivityReport(context, filter: filter) } } .onAppear { DispatchQueue.main.async { report = DeviceActivityReport(context,
Replies
0
Boosts
0
Views
690
Activity
Nov ’24
How to Filter App Usage for a Specific Time Period Using Screen Time API?
I am working on a SwiftUI app using the Screen Time API and the DeviceActivityReport view to display app usage data. My current implementation successfully shows daily app usage using a DeviceActivityFilter with the .daily(during:) segment. However, I need to filter this data to show app usage only for a specific time period during the day, e.g., 4:00 PM to 5:00 PM. I created a DeviceActivityFilter with a .daily(during:) segment and passed a DateInterval for the desired time range: let now = Date() let startTime = calendar.date(bySettingHour: 16, minute: 0, second: 0, of: now)! let endTime = calendar.date(bySettingHour: 17, minute: 0, second: 0, of: now)! let timeInterval = DateInterval(start: startTime, end: endTime) let filter = DeviceActivityFilter( segment: .daily(during: timeInterval), users: .all, devices: .init([.iPhone]) ) I applied this filter to the DeviceActivityReport view: DeviceActivityReport(context, filter: filter) Even with the DateInterval set for the specific time
Replies
0
Boosts
0
Views
493
Activity
Dec ’24
Send device acitivty data to external server
Hi all, after a couple days trying to build a parental control app with screen time API, I wonder if there is any way to send device activity data to an external server. I tried to use DeviceActivityReport but it is a sandbox and can’t get the data Thank you so much for your help.
Replies
1
Boosts
0
Views
796
Activity
Apr ’23
HELP ScreenTime API DeviceAcivityReport continious issues
Hi everyone, I've been spending my evenings on the app for around 6 months that's using Screen Time API introduced in WWDC 21 (https://developer.apple.com/videos/play/wwdc2021/10123/), I'm having many issues with this API and looking for anyone who has experience with this API, I will appreciate any help or advice I can get! I'm using DeviceActivityReport to display the dashboard with screen time usage and certain metrics. Device activity report extension runs in an isolated sandbox, which makes it harder to debug and can't make any network call or write to any storage, for privacy purposes which makes sense, but makes it very hard for development. The issue is that the process where DeviceActivityReport is running crashes for no reason frequently or doesn't run at all. The API itself has many bugs, which is backed up by my experience, Opal app developers and Screen Time even made the news with its bugs. I see the same behaviour with other apps like Opal, but they can workaround somehow it a
Replies
2
Boosts
0
Views
1.8k
Activity
Nov ’23
Device Activity Report: Resolving 'Context' Type Issue in TotalActivityReport.swift
Hello Apple Developers, I've encountered an issue while working on a DeviceActivityReport in Swift. The problem arises when attempting to use the Context type from DeviceActivityReport. Here is the snippet of the code causing the problem: import DeviceActivity import SwiftUI extension DeviceActivityReport.Context { // If your app initializes a DeviceActivityReport with this context, then the system will use // your extension's corresponding DeviceActivityReportScene to render the contents of the // report. static let totalActivity = Self(Total Activity) } struct TotalActivityReport: DeviceActivityReportScene { // Define which context your scene will represent. let context: DeviceActivityReport.Context = .totalActivity // Define the custom configuration and the resulting view for this report. let content: (String) -> TotalActivityView func makeConfiguration(representing data: DeviceActivityResults) async -> String { // Reformat the data into a configuration that can be used to
Replies
2
Boosts
0
Views
885
Activity
Aug ’24
Family control app uploading error
/Users/varunashokbhaisidpara/Desktop/Screenshot 2024-11-15 at 5.43.44 PM.png This error occurs When I try to upload an app on the test flight or App Store. I checked Automatically manage signing in the main target. and i have added extensions DeviceActivityMonitorExtension, ShieldConfigurationExtension, ShieldActionExtension, DeviceActivityReport. and all have selected Automatically manage signing in the target > signing and capability. pls provide me with an exact solution set by step. Thank you
Replies
3
Boosts
0
Views
890
Activity
Nov ’24
Screen Time API - Device Activity Report
I need some assistance with the Screen Time API’s DeviceActivityReport extension. I know the extension is sandboxed but I need the data inside my app. Jomo is currently doing this so it’s not impossible. I see they’re saying it’s an estimate which is about 5 - 10 off of the actual screen time, but how are they doing this? Any attempt to store the screen time data inside some sort of database or UserDefaults always fails of course due to the sandbox. Any advice would be greatly appreciated!
Replies
0
Boosts
0
Views
501
Activity
Oct ’24