<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceActivity",
  "identifier" : "/documentation/DeviceActivity/DeviceActivityEvent/init(applications:categories:webDomains:threshold:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Device Activity"
    ],
    "preciseIdentifier" : "s:14DeviceActivity0aB5EventV12applications10categories10webDomains9thresholdACShy15ManagedSettings5TokenVyAH11ApplicationVGG_ShyAJyAH0B8CategoryVGGShyAJyAH9WebDomainVGG10Foundation14DateComponentsVtcfc"
  },
  "title" : "init(applications:categories:webDomains:threshold:)"
}
-->

# init(applications:categories:webDomains:threshold:)

Creates a new event.

```
init(applications: Set<ApplicationToken> = [], categories: Set<ActivityCategoryToken> = [], webDomains: Set<WebDomainToken> = [], threshold: DateComponents)
```

## Parameters

`applications`

An optional list of applications to include in the event. A small subset of popular App Store
apps have known associated web domains that get included implicitly. For example, an event that includes
an app implicitly includes usage of the app’s web domain.

`categories`

An optional list of categories to include in the event.

`webDomains`

An optional list of web domains to include in the event. Some web domains have associated apps included implicitly.

`threshold`

The amount of time that results in a callback to a [`DeviceActivityMonitor`](/documentation/DeviceActivity/DeviceActivityMonitor).

## Discussion

An application’s extension receives a callback once the combination of specified [`applications`](/documentation/DeviceActivity/DeviceActivityEvent/applications), [`categories`](/documentation/DeviceActivity/DeviceActivityEvent/categories),
and [`webDomains`](/documentation/DeviceActivity/DeviceActivityEvent/webDomains) have been in use longer than the event’s threshold within the activity’s scheduled interval.
If your app didn’t specify any `applications`, `categories`, or `webDomains`, the event includes all `applications`, `categories`,
and `web domains`.

> Important: When your app calls ``doc://com.apple.DeviceActivity/documentation/DeviceActivity/DeviceActivityCenter/startMonitoring(_:during:events:)`` and the
> event’s schedule is active, the system will only consider the person’s device activity when it starts monitoring the event.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)