Hello,
I am trying to create a Home Screen widget for iOS that displays device usage statistics — similar to the built-in Screen Time widget Apple provides. The goal is to show the average device usage for a specified period (daily, weekly, or monthly) and optionally include a comparison with the previous period.
I noticed that Apple’s own Screen Time widget presents such information. However, after reviewing the public documentation, I could not find any available API that allows a developer to create a similar experience.
To explore possible alternatives, I implemented a SwiftUI view inside a com.apple.deviceactivityui.report-extension using the Family Controls and Device Activity frameworks. The view works fine within the main app and the report extension context, but when I attempted to use the same view in a WidgetKit extension, I received an error at runtime. This suggests that views from com.apple.deviceactivityui.report-extension are not usable inside widgets, which I understand may be due to sandboxing or limitations of how the extension points are designed.
So far, I’ve found no way to access cumulative or average usage data (screen time, app usage, etc.) from system APIs that can be shown in a widget context. My understanding is that Family Controls and Device Activity frameworks allow observing ongoing activity and building usage reports inside the app, but do not provide access to the same historical or summarized data that Apple’s own widgets display.
Could you please confirm:
- Whether there is any supported way to access average device usage (screen time) data for use in a widget?
- If not, is this an intentional limitation due to privacy concerns, or is there a roadmap for exposing such APIs in the future?
- Are there any APIs or entitlements that could allow similar functionality via WidgetKit?
Thank you for your time and support.
Best regards,