autographScope

Declares scope properties for the taps captured in this fragment only — a detail screen's item id, a list's variant — the native counterpart of autograph-compose's AutographScope (#239).

A root ScopeStack.push cannot do this: it is app-wide by construction, so the property would land on every other surface's taps too — a wrong value rather than a missing one. This puts the properties on the frame installAutographNativeScreenCapture keeps for the fragment, so they reach exactly the events that capture attributes to it:

  • taps the native tap capture resolves to a view inside the fragment, and taps in a Compose AutographProvider hosted inside it;

  • the same events of surfaces nested inside it — a child fragment's taps and Screen Viewed, the autocaptured taps of the composition it hosts — whose own scope merges over it, the inner value winning a key clash, as nested AutographScopes do. Not that composition's own events (TrackedScreen, trackClick), which take scope from AutographScope only;

  • its own Screen Viewed, when declared before the fragment resumes (in onCreate).

Not a sibling fragment's taps, and not the taps on the Activity around it. Precedence is the same as for AutographScope: above a default property, below a property the capture sets itself and the reserved screen / section. Explicit Tracker.track calls are untouched — this feeds autocapture only.

Compose content in a Dialog, Popup or sheet captured through Modifier.autographAutocaptureRoot resolves from the enclosing provider's origin, so this scope reaches it as it reaches the content beside it. Native views in such a window are outside the native tap capture (see installAutographNativeTapCapture).

Lifetime: the fragment's, not the call site's

Call it once, from onCreate. The declaration lasts until the fragment is destroyed and covers every view the fragment creates in between: a fragment whose view is destroyed and re-created (detach / attach, the back stack) keeps its scope without being asked again. Calling it again for the same fragment and scopeStack — from onViewCreated on every view, say — replaces the properties of the existing declaration and returns its handle; it never stacks a second one. A fragment that is already destroyed declares nothing.

Use AutographScopeHandle.update to revise the properties later (an item id that arrives after the data loads). The handle does not keep the fragment alive.

It needs the native screen capture

The scope lives on the capture's frame for the fragment, so it takes effect only while installAutographNativeScreenCapture runs on the same scopeStack. Without it, nothing is attributed to the fragment and the scope is simply absent — never app-wide. A capture installed later picks the declaration up at the fragment's next resume.

Values are strings, as the same shape is meant for iOS, where a Swift caller cannot build a JsonObject. Main thread only, like the lifecycle it is bound to.


Declares scope properties for the taps captured in this Activity: on its own views, and in every fragment and Compose AutographProvider inside it, each of which may declare its own scope on top (the inner value winning a key clash).

The same contract as Fragment.autographScope: bound to the Activity's lifecycle (call it from onCreate; it lasts until onDestroy), a second call replaces the properties, and it takes effect only while installAutographNativeScreenCapture runs on the same scopeStack. A configuration change creates a new Activity instance, whose onCreate declares again.