Overview
As soon as your app launches, configure the SDK with your API Key. This initializes the native Encore SDK on whichever platform the app is running on (iOS or Android). If your Encore flows include an in-app purchase, you register your purchase controller here too, and only here: both native SDKs bind the controller insideconfigure and expose no setter afterwards.
Initialize Encore in Your App
Callconfigure early in your app lifecycle, before identifying users or presenting offers. The recommended place is in main():
pk_your_api_key_here with your publishable Live key, which you retrieve yourself from the Dashboard under Settings → Project API Keys (use the Test key for staging and local development).
Can’t find your API key? Open your project’s Settings → Project API Keys in the Encore Dashboard and copy the Live key (or Test for non-production builds).
Register a purchase controller
Encore controls when a purchase happens; your app owns how. ImplementEncorePurchaseController and pass the instance to configure. This is the SDK’s only purchase path: it never runs purchase code you did not write.
reset(): the controller is app-level infrastructure, not user state.
If your Encore flows have no in-app purchase, omit the argument. The SDK then never attempts a purchase at all, and every presentation records EncorePublisherOutcome.notAttempted. That is a supported configuration, and a different behavior from registering a controller that always fails.
Android’s native controller also hands over the foreground
Activity. The plugin absorbs it, since it is valid only for the duration of the call, so one Dart contract covers both platforms.Configuration options
unlock selects how a claim flow runs, never how a result is read: the presentation record is written identically in both modes.
Next Steps
Now that Encore is configured, you’re ready to:- User Management: identify users for entitlement tracking
- Present Offers: show promotional offers and read the result