I tried by changing the segment in the filter, but still giving duration for full day.
@State private var filter = DeviceActivityFilter(
segment: .daily(during: timeRange),
users: .all,
devices: .init([.iPhone, .iPad])
)
Is there any way to get the screen time duration of apps in IOS for specific time range?
Post
Replies
Boosts
Views
Activity
Goal is to get/save the captured photo (From default camera) immediately from my app when the app is in background.
When I capture a photo with default camera, photoLibraryDidChange(_:) function do not execute that time. But when I reopen my app, that time this function executes and give the images, which were captured in that particular time.
how to execute photoLibraryDidChange(_:) when app is in background?
Is there any way to remain the ios apps active even after removing it from recents or after killing it?
I want to generate a video from some images and that video should have some animation while changing one image to another.
is it possible with UIView.transition(with:duration:options:animations:completion:) ? If it possible, then how can I achieve this ?
Wrote a transition code for some images. It can show image one by one. But I want to create a video with this kind of animations (Zoom in, Zoom out etc). How can I achieve this.
UIView.transition(with: self.imageView,
duration: 2.0,
options: .transitionCrossDissolve,
animations: {
self.imageView.image = UIImage(imageLiteralResourceName:
"image2")
}, completion: nil)
I am working with DeviceActivity to get the screen time. I always have screen time zero second (0s). But it should have some value.
I am selecting apps using familyActivityPicker and passing the tokens in the filter.
@State private var context: DeviceActivityReport.Context = .init(rawValue: "Total Activity")
filter = DeviceActivityFilter(
segment: .daily(
during: Calendar.current.dateInterval(
of: .weekOfYear, for: .now
)!
),
users: .all,
devices: .init([.iPhone, .iPad]),
applications: applications,
categories: categories,
webDomains: webDomains
)
DeviceActivityReport(context, filter: filter)
I saw various posts regarding this, but nothing working in my side. I am unable to identify the issue of getting zero second all the time.
I implemented an app in SwiftUI using Screen Time API, which can show apps usage duration from Device Activity Report Extension. Device Activity Report Extension is a separate target.
Now I want to save those data into CoreData from Device Activity Report Extension and fetch that from my main app target. How can I Achieve that ?