Hello! I am a new developer and am attempting to use Apple's Device Activity API. However, I am struggling with the View of the Device Activity Report. For one, the view stretches to fill all available space instead of simply being the size of its content. Secondly, the background color seems fixed and I can't figure out how to remove it. The Screen Time API demo video shows this Device Activity API used with a clear background, so I know it is possible, I just can't figure out how to do it as it seems to be built into the Device Activity Report itself. Does anyone have any ideas? I'll attach a photo to show you what I mean. The black box is the Device Activity Report that I am trying to edit. Thank you for your help!
Device Activity Report View Size and Background
Hey ! This is due to the fact that those views are rendered of process, you need to assign a fixed size to your view, and cannot assign a background color.
We opened a bug report for those exact things a while ago but didn't get any answers (FB10819848 (DeviceActivityReportScene doesn't behave like a regular SwiftUI view in an undocumented way), opened 06/22/22)
I invite you to open a bug report as well !
Regards
Hello @caleb4hzglory , how can I make a particular app show usage time?
@caleb4hzglory How do you able to get data from the DeviceActivityReport Extension? I always have empty content view. Can you share to me your code snippet how you do it? Thanks
Hi @caleb4hzglory, yh im having same issue as @JosephCa not being able to see anything from my content view when i add the DeviceActivityReport. Can you share with us some code snippet or idea how you get working on physical device please thank you
im getting a black background when I call DeviceActvitiyReport(.init("..."))
no matter what I do. It seems to be overriding (generating on top of) any background i set that view. any ideas?
Hey @WorkTechnotoil ! I answered a similar question to @JosephCa below, so hopefully that helps! Sorry for not seeing this for so long.
Hi @caleb4hzglory ! I tried link source code https://github.com/PedroSomensi/DeviceActivity/tree/main
I run on physical device and requestAuthorization FamilyControlsMember.individual done. It is working but it don't show list activity report.
I check DeviceActivityReportAdapter file, I think the filter variable is missing applications, categories, webDomains.
Please help me if you online, Thank you so much!