Observer Mode

Learn how to use Adapty Flutter SDK in the Observer mode along with an existing purchase infrastructure

If you have a functioning subscription system and you want to give Adapty SDK a quick try, you can use an Observer mode. With just one line of code you can:

Adapty SDK will automatically collect all transactions and send subscription events. To turn on Observer mode, just set AdaptyObserverMode key to true in your .plist file for iOS or AndroidManifest.xml for Android:

// in Info.plist
<dict>
    ...
    <key>AdaptyPublicSdkKey</key>
    <string>PUBLIC_SDK_KEY</string>
    <key>AdaptyObserverMode</key>
        <true/>
</dict>
// in AndroidManifest.xml
<application ...>
       ...
       <meta-data
              android:name="AdaptyPublicSdkKey"
              android:value="PUBLIC_SDK_KEY"
              android:name="AdaptyObserverMode"
              android:value=true />
</application>

🚧

When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it

A/B tests analytics

In an Observer mode, Adapty SDK doesn't know, where purchases was made from. If you display products using our Paywalls or A/B Tests, you can manually assign variation to the purchase. After doing this, you'll be able to see metrics in an Adapty Dashboard

try {
    await Adapty.setTransactionVariationId('<transactionId>', '<variationId>');} 
on AdaptyError catch (adaptyError) {}
catch (e) {}

Request parameters:

  • variationId (required): a string identifier of variation. You can get it using variationId property of AdaptyPaywall
  • transactionId (required): a string identifier of your purchased transaction SKPaymentTransaction for iOS or a string identifier (purchase.getOrderId()) of the purchase, where the purchase is an instance of the billing library Purchase class for Android

Did this page help you?