Skip to main content

Purpose

Create and present Encore offers using a fluent builder API. Fetches available offers for the current user and presents them in a native offer sheet. show() returns the complete PresentationResult record and never throws.

Signature

Encore.placement(id) is the one way to create a placement. The instance form Encore.shared.placement(id) is deprecated and is removed in the next major release.

Methods

show() never throws: every failure is a value on the result, including calling before configure() (NotPresented(NotConfigured)). The suspending forms are safe to call from any thread or scope; the body runs on a background dispatcher and UI work is hopped to Main internally.
Copy overrides resolve in strict priority order, first one set wins: this override, then the copy Encore resolved for your app, then the shipped template default. A blank string is ignored, so the chain falls through rather than rendering an empty line. See Where the copy comes from.

Use cases

A use case selects which template the backend resolves and which funnel the presentation is counted in. It is a different axis from the placement ID: one use case holds many placements. Each case carries a fixed wire value ("churn-intervention" and "post-action-reward") that the backend stores and that analytics splits the funnel on. The constant names are the API surface; the wire values are the contract.

Moment

In debuggable builds with logLevel = LogLevel.DEBUG, a placement shown with no moment logs one warning per placement. How to choose a moment type: Tell Encore the Moment.

Location and trigger

These describe the placement and belong to your app: they change when you ship a new screen or button, so pass them in code on each placement your own UI opens, after the moment. Both are optional. Use embedded when your launcher sits inside a screen, popup or sheet that shows other content (a button in a celebration popup), and standalone when the launcher is the whole UI that appears (a toast, a drop-down notice, a floating badge). Trigger components report their own trigger values. See Describe your placement in code.

Usage

Callback form

Result delivery is not foreground-gated: the callback fires even if your Activity backgrounded mid-flow. Don’t touch views without checking your own lifecycle.

Reward surface

Reward for trying

From 2.3.0, publisherReward() describes a prize your app pays for trying an offer. When the user says they finished and Encore’s server grants the prize, result.claim?.userConfirmedCompletion is true on the result show() returns (or passes to show(onResult:)), and your app grants the prize from that result only (the outcomes stream carries the same result, so granting from both pays twice). The server keys the prize on the ID you pass to identify(), so only identified users are promised one. Setup, the daily limit, and when the flag stays false: Reward for Trying.

With named placements for analytics

Provide a descriptive placement ID to identify this specific placement in your analytics. If omitted, a random ID is generated.

Appearance

The sheet renders in light, dark, or automatic appearance, following the appearance mode configured for your app in the Encore dashboard. Automatic is the default: the sheet follows your host app’s theme, falling back to the device setting when that theme can’t be read. The sheet runs in its own Activity, so this is what keeps it visually part of the app it presents over rather than following the device past a host that pins its own style. fun appearance(config: AppearanceConfig): PlacementBuilder styles this presentation. Its sheet: SheetAppearance? field gives the reward sheet your fonts, colors, corners, and images per component; see Sheet Appearance.

SheetAppearance

AppearanceConfig.sheet styles a served reward sheet per component, and a value set in the Style editor (when it is on for your app) wins over app code per property. Fonts come from app code only. How to use it: Sheet Appearance.

Structure

Field reference

SheetAppearance SheetComponentStyle: every field is optional. The element the variant draws decides which fields apply; a field that does not apply, or a value out of range, is dropped with a warning in the SDK log. animation enter and loop: both are skipped or held still when the device asks for reduced motion.

Claim CTA toggle

Encore.shared.isClaimEnabled controls whether the claim CTA on offer cards is tappable. It is runtime-mutable by design: flip it to false to gray out and disable the claim button, and back to true to re-enable it.