Can I read FamilyActivitySelection the container app saved in the Device Activity Report Extension?

  1. In the container app, use FamilyActivityPicker to select some categories & applications, and set a limit usage time. save the result in UserDefaults.

  2. in the DeviceActivityMonitor extension, read the saved selection to present the shield. it works.

  3. in the DeviceActivityReportScene extension, read the saved selection, in the report add a special icon for categories & applications with limited usage time. it does not work.

in the third step, I can read the saved selection, but I can't match the selected data with DeviceActivityResults in the makeConfiguration function.

Accepted Reply

Unlike the Device Activity monitor extension, the report extension runs in a sandbox that prevents your extension from making network requests or moving sensitive content outside the extension’s address space. However, defaults that are shared between an app and its extensions via App Groups should be readable by report extensions. If this is not working, please reproduce the issue and file a bug report with a sysdiagnose shortly after reproducing.

As a workaround, you may consider passing the desired apps and categories from your app to your extension via a DeviceActivityFilter so that your extension only receives CategoryActivity and ApplicationActivity results for the selection made in step 1.

Replies

Unlike the Device Activity monitor extension, the report extension runs in a sandbox that prevents your extension from making network requests or moving sensitive content outside the extension’s address space. However, defaults that are shared between an app and its extensions via App Groups should be readable by report extensions. If this is not working, please reproduce the issue and file a bug report with a sysdiagnose shortly after reproducing.

As a workaround, you may consider passing the desired apps and categories from your app to your extension via a DeviceActivityFilter so that your extension only receives CategoryActivity and ApplicationActivity results for the selection made in step 1.