1

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

class MyDeviceActivityMonitor: DeviceActivityMonitor{
    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>
Anish Lal
  • 11
  • 6
  • did you resolve it ? if yes, can you please share your experience – Sultan Ali Apr 24 '22 at 07:57
  • No @SultanAli still I'm stacked in same issue – Anish Lal Apr 26 '22 at 10:12
  • Hey, just a quick question. Is anything from that API available on one device without the need of parent-child combination? What's really important for me is to get & display app usage data in given interval of other apps. Is this even possible? Thanks for the info – Marc Sanny Apr 26 '22 at 11:08
  • Is it solved. could you, please, share your experience? – astghik Jan 14 '23 at 14:01

1 Answers1

0

I am stuck in this issue too. Have you tried changing the NSExtensionPrincipalClass to the below?

<string>$(PRODUCT_MODULE_NAME).MyDeviceActivityMonitor </string>
g0mi
  • 1
  • I found either applications or categories cannot be empty for the DeviceActivityMonitor functions to be triggered. In my case, though nothing was shown when calling print() inside those functions, other actions like shielding an app or showing a notification were working properly. – g0mi May 05 '22 at 20:25