Device Activity

RSS for tag

Monitor web and app usage through custom time windows and events.

Posts under Device Activity tag

43 Posts
Sort by:
Post not yet marked as solved
1 Replies
48 Views
Hi! DeviceActivityMonitors methods IntervalDidStart, IntervalDidEnd and eventDidReachThreshhold do not seem to be called on my application. Has anyone found a solution to this problem. Thank you in advance.
Posted
by JJS21.
Last updated
.
Post marked as solved
5 Replies
281 Views
I am unable to make any progress regarding DeviceActivityReport. The session from WWDC 2022 covers it very briefly. What I (hopefully correctly) understood is that we need to create an extension of type Activity report and inside it implement the body which is DeviceActivityReportScene that will display the charts and what not. And then in the app, we need to use DeviceActivityReport with SwiftUI to show the report which will be run in sandbox from the extension. But I cannot get anything to show up on the screen. Even when my extension view is just a static text to verify something gets displayed. I am trying to create the device activity report without any filter which should give me all activity data per the docs. This is shown in the Xcode console for the view that uses DeviceActivityReport. 2022-06-17 18:08:47.219785+0200 DeviceActivityTest[9613:954204] [default] 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=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} 2022-06-17 18:08:47.219862+0200 DeviceActivityTest[9613:954204] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2022-06-17 18:08:47.219911+0200 DeviceActivityTest[9613:954204] [db] 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=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} 2022-06-17 18:08:47.290070+0200 DeviceActivityTest[9613:954204] [default] Remote viewcontroller request failed: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 9615 named com.apple.DeviceActivityUI.DeviceActivityReportService.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid." UserInfo={NSDebugDescription=The connection to service with pid 9615 named com.apple.DeviceActivityUI.DeviceActivityReportService.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}
Posted
by nemecek_f.
Last updated
.
Post not yet marked as solved
2 Replies
401 Views
I got a client request to build a parental control app like Parentkit(https://parentkit.co/) or Ourpact (http://ourpact.com/) to help parents manage their children devices. After doing some research online, I figured that it could be a MDM feature and requires an apple enterprise account for implementation. However, Apple developer program support does not allow me to create an enterprise account for developing a MDM system for non-company members. They also said that any non-company use of MDM is not allowed by Apple. If what they said is true, MDM implementation should not be allowed in the abovementioned parental control apps. Would they be using other means without the need to register an enterprise account to archieve real-time, over-the-air control on device restriction? If that is the case, what else I should read and work on to build a parental control apps like those without registering an enterprise account?
Posted
by ma_eric.
Last updated
.
Post not yet marked as solved
1 Replies
92 Views
I've been trying to get something to work with the Screen Time API, but almost everything related to it is unimplemented. I checked following links Device Activity https://developer.apple.com/documentation/DeviceActivity Managed Settings https://developer.apple.com/documentation/ManagedSettings Family Control https://developer.apple.com/documentation/FamilyControls Checked videos https://developer.apple.com/videos/play/wwdc2022/110336/ Problems I faced FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. There is no way to allow setting up of restrictions for individual kids, if we have many kids in family. If anyone gone through the same problem please upvote or if anyone has a solution please share Thanks
Posted Last updated
.
Post not yet marked as solved
1 Replies
106 Views
To shield applications, we have to pass ApplicationTokens to DeviceAcvivityMonitorExtension. But I don't know the way. I tried to pass it by using NSUserDefaults. However, it didn't work because ApplicationToken isn't encodable. So I can't save it in UserDefaults Does anyone knows the way to pass ApplicationTokens to the Extension or another way to shield apps?
Posted
by toshi2001.
Last updated
.
Post not yet marked as solved
4 Replies
202 Views
I want to know the structure how to send restrict information from parent to child. When parent sets restriction on parent's device, that information is reflected on the child's device and the child is restricted from using the app and device. I want to know how the restrictions set on the parent's device are transmitted to the child's device. Also, I want to know how to do it. I could even call requestAuthorization and succeed. Does anyone know this?
Posted
by toshi2001.
Last updated
.
Post not yet marked as solved
0 Replies
88 Views
When use the DeviceActivity api to create a DeviceActivityReport, all of the ApplicationActivity.application objects have a nil localizedDisplayName. ApplicationActivity(application: ManagedSettings.Application(bundleIdentifier: Optional("com.netflix.Netflix"), token: nil, localizedDisplayName: nil), totalActivityDuration: 0.0, numberOfPickups: 0, numberOfNotifications: 1, isTrusted: true) I see in the documentation for Application.localizedDisplayName the following: In an extension that provides shield configurations, this property provides the app’s name. When you access this property outside that extension, the value is nil. See ShieldConfigurationDataSource in the Managed Settings UI framework for more information. I am using the property in an extension that provides shield configurations so it should not be nil. I do see that ManagedSettings.ActivityCategory.localizedDisplayName is set properly and that in its documentation that it has the same requirement with shield configurations. CategoryActivity(category: ManagedSettings.ActivityCategory(identifier: Optional("DH1003"), token: nil, localizedDisplayName: Optional("Entertainment")), totalActivityDuration: 0.0, applicationActivities: [DeviceActivity.DeviceActivityData.ApplicationActivity(application: ManagedSettings.Application(bundleIdentifier: Optional("com.google.ios.youtube"), token: nil, localizedDisplayName: nil), totalActivityDuration: 0.0, numberOfPickups: 0, numberOfNotifications: 1, isTrusted: true), DeviceActivity.DeviceActivityData.ApplicationActivity(application: ManagedSettings.Application(bundleIdentifier: Optional("com.microsoft.smartglass"), token: nil, localizedDisplayName: nil), totalActivityDuration: 0.0, numberOfPickups: 0, numberOfNotifications: 3, isTrusted: true)], webDomainActivities: []) Since categories' display names are being set correctly, this seems like a bug in the beta to me. Has anyone else seen this issue?
Posted
by tjpaul.
Last updated
.
Post marked as solved
1 Replies
167 Views
Hi everyone, I am trying to change the settings when the shield button is clicked. When I called let store = ManagedSettingsStore() in the ShieldAction extension, store.shield.applications is nil. How can I access the instance created in the host app? Besides, has anyone ever tried to change the shield UI after clicking a button on the shield screen? I've searched around but no luck. is there any way I can notify the host app for further actions? Any help would be appreciated! Thank you very much. Sorry I don't know why I can't add the wwdc21-10123 tag.
Posted
by g0mi.
Last updated
.
Post not yet marked as solved
2 Replies
178 Views
Hi! I'm playing around with the Screen Time API. I would like to let my app notify me every time I have used my device for 1 minute (any app). When I have been notified, I would like to reset the monitoring so that I will be notified again after another minute using my device. I'm not sure how to accomplish this. In the main app, I currently start monitoring the following event with a schedule: let event = DeviceActivityEvent(threshold: DateComponents(minute: 1)) let schedule = DeviceActivitySchedule(intervalStart: DateComponents(hour: 0, minute: 0, second: 1), intervalEnd: DateComponents(hour:23, minute: 59, second: 59), repeats: true) Then, in the Device Activity Monitor Extension, I restart the same monitoring once the threshold is reached in eventDidReachThreshold. However, eventDidReachThreshold is being called much more than once an hour. I have checked that I only have one monitoring event running, so duplicates does not seem to be a problem. So, my questions are: Does my approach look OK? What am I missing? Would this monitoring collect usage from all devices connected to the same Apple ID, i.e. my Mac, iPad, iPhones etc? If so, how can I make it only monitor usage on one of my devices (the iPhone running the app)?
Posted
by cmj.
Last updated
.
Post not yet marked as solved
1 Replies
186 Views
Hi dear , I am a beginner developer I have an application idea , and I think its great idea 😎 I think the application needs to use Device activity frame work , and UIScreen class , even if the app is in background or terminated , the problem is I don't know how to use these classes and frameworks 🤷🏻‍♂️ the questions are : can I detect UITouch event on UIScreen object even if the app is in background or terminated How to get the current activity name of the device
Posted Last updated
.
Post not yet marked as solved
16 Replies
5.1k Views
I've been trying to get something to work with the Screen Time API, but almost everything related to it is completely and truly broken/unimplemented. I've tried all of this in the iOS 15 Beta 2 and 3 and Xcode 13 Beta 2 and 3. These are just a handful of the bugs I came across: Screen Time APIs do not work on the simulator. Calling AuthorizationCenter.shared.requestAuthorization on a simulator with a logged in child account always results in "FamilyControls.FamilyControlsError Code=3" FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. It's not clear at this point whether FamilyActivityPicker needs to be called on the parent or the child device. Assuming restrictions can actually be set, there is no API to allow setting up of restrictions for individual kids. After successfully authorizing a child device via AuthorizationCenter.shared.requestAuthorization, DeviceActivityCenter.startMonitoring always results in an MonitoringError.unauthorized error. AuthorizationCenter.requestAuthorization error in callback cannot be mapped back to FamilyControlsError because it is a plain NSError with an error code and FamilyControlsError does not expose an initialiser that takes a rawValue. Even though an app is authorized to managed ScreenTime on a child device, the child can always just delete the app. (I would try to submit a bug with device diagnostics about this using Feedback Assistant, but to top it all off at the moment I am receiving an error in FA that says "Unable to gather diagnostics" / "A problem was encountered when trying to gather diagnostics. Try gathering diagnostics again"). There's no device activity / shield configuration or shield action extension templates in Xcode. For those wondering, I created a CallDirectory extension and then changed the NSExtensionPointIdentifier in the plist to the appropriate value. What is the appropriate value? It's not mentioned in the documentation :), so I had to dig around in the Xcode support files to find out the following identifiers: com.apple.ManagedSettings.shield-action-service com.apple.ManagedSettingsUI.shield-configuration-service com.apple.deviceactivity.monitor-extension And this leads me to my last item: the documentation which is absolutely lacking. There is no programming guide for the frameworks and the Homework app we saw developed during WWDC is not available. It's not clear how the settings from the guardian app get applied to the child app. Is there a built-in mechanism or do we need to use our own implementation to transfer those changes (via push or whatever)? Of course I reported almost all of this via Feedback Assistant, but considering I had previous feedback for other APIs sit there untouched for years in the past, it's really frustrating and it feels like I'm just talking to myself with those bug reports. So, did I do something wrong and completely misinterpreted the capabilities and functionality of the ScreenTime API or is it truly broken and non-functional in iOS 15 Beta 2/3? There's absolutely no mention of these issues in the release notes so I am starting to question my sanity here.
Posted
by clawoo.
Last updated
.
Post marked as solved
1 Replies
237 Views
Hi all, I am facing a problem following the code in the "Meet the Screen Time API" video. I've tried scheduling the monitoring time from 00:00 to 25:59 or some other time but functions in DeviceActivityMonitor are never being called. I tried to print log from those functions, nothing shown. Is there any settings I've missed? In addition, I already changed the NSExtensionPrincipalClass value to my class name. Any help would be appreciated!
Posted
by g0mi.
Last updated
.
Post not yet marked as solved
0 Replies
154 Views
Hi everyone, I am going to develop an app that manage a user's own app usage and activities. I know that there's a ScreenTime API but looks like it's for family control only. Is there any way that I can list app usages of my own device in my app? Any answer will be appreciated. Thank you very much.
Posted
by g0mi.
Last updated
.
Post marked as solved
2 Replies
899 Views
i'm trying to shield and block apps on child device. i managed to block apps by creating a  variable blockedApps : Set = Set() that contains a list of applications like Application(bundleIdentifier: "com.apple.calculator") inside the intervalDidStart on my DeviceActivityMonitor extension now i'm trying to shield an app using the same extension and nothing happens. for this i used this code inside intervalDidStart:   let calculatorApp = Application(bundleIdentifier: "com.apple.calculator")     var blockedApps : Set = Set()           guard let token = calculatorApp.token else {       return     }     blockedApps = [token]     store.shield.applications = blockedApps and i cant tell what is the reason for this not working is there a token issue that is nil? does shielding requires a different app extension? does my app extension requires some additional configuration maybe a different NSExtensionPointIdentifier?
Posted
by vova085.
Last updated
.
Post not yet marked as solved
0 Replies
218 Views
Using shared authorization I am able to authorize the child's device and able to see all the installed apps on the child's mobile on the parent device. But when I am trying to call DeviceActivity nothing happens. This is how I am calling DeviceActivity override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) } override func eventDidReachThreshold(_ event:DeviceActivityEvent.Name,activity:DeviceActivityName){ super.eventDidReachThreshold(event, activity: activity) } } info.plist <key>NSExtension</key> <dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.deviceactivity.monitor-extension</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).DeviceActivityMonitorExtension</string> </dict>
Posted Last updated
.
Post not yet marked as solved
1 Replies
472 Views
Dear Friends, We are developing an application for IOS, but we are challenging in a situation. We want to track usage time of other apps such as Duolingo, Tandem etc. in our application. We don't want to track application, we only aim to track usage time. Related to this, we found an API called Screen Time API, nevertheless we couldn't be sure that we are allowed to take such information. In this manner, we need your recommendations and comments about this idea and API. The app will support users to reach their aims by tracking their usage of some specific apps that are related to their targets. For instance, if a person needs to practice some language in Tandem, he or she can see Tandem usage on our app. Can we import their usage time information of the users' apps? Can we use Screen Time API to realize this target? Will we need to create a document like proposal for the AppStore team to express our aim and method?
Posted Last updated
.
Post not yet marked as solved
0 Replies
457 Views
In familyActivityPicker I can select Apps and Categories but there is no way to add websites. In Apple own screentime App same control (familyActivityPicker) provides a way to add websites. Is there some sort of settings/entitlement or capability required to added in the project?
Posted
by AsifmDev.
Last updated
.
Post not yet marked as solved
0 Replies
232 Views
I'm wondering if anyone has an example of an implementation of the Screen Time API / DeviceActivity Framework. It's really hard to find any information about it, and seeing an example in practice would help me a lot.
Posted Last updated
.