Flutter – Configuring
iOS
Create Adapty-Info.plist
and add it to you project. Add the flag AdaptyPublicSdkKey
in this file with the value of your Public SDK key.
<dict>
<key>AdaptyPublicSdkKey</key>
<string>PUBLIC_SDK_KEY</string>
</dict>
Android
Add the flag AdaptyPublicSdkKey
in the app’s AndroidManifest.xml
(Android) file with the value of your Public SDK key.
<application ...>
...
<meta-data
android:name="AdaptyPublicSdkKey"
android:value="PUBLIC_SDK_KEY" />
</application>
Public SDK key can be found in your app settings in Adapty Dashboard
App settings
>General
.
Then in your application:
import 'package:adapty_flutter/adapty_flutter.dart';
And finally, activate Adapty SDK with the following code:
try {
Adapty().activate();
} on AdaptyError catch (adaptyError) {}
} catch (e) {}
Make sure you use the Public SDK key for Adapty initialization, the Secret key should be used for server-side API only.
SDK keys are unique for every app, so if you have multiple apps make sure you choose the right one.
Logging System
Adapty logs errors and other important information to help you understand what is going on. There are three levels available:
- error: only errors will be logged
- warn: messages from the SDK that do not cause critical errors, but are worth paying attention to
- info: various information messages, such as those that log the lifecycle of various modules
- verbose: any additional information that may be useful during debugging, such as function calls, API queries, etc.
You can set logLevel
in your app before configuring Adapty.
try {
await Adapty().setLogLevel(AdaptyLogLevel.verbose);
} on AdaptyError catch (adaptyError) {
} catch (e) {}
Collecting usage logs (iOS only)
The Adapty SDK allows you to activate the remote logging system. If you are experiencing any problems during a review process, or you need help with analyzing something in the production environment, you will need to activate this system both in the application's build itself and in our system (Contact the technical support team for the assistance).
To activate this system, put the AdaptyEnableUsageLogs
key to the Adapty-Info.plist
:
<dict>
<key>AdaptyEnableUsageLogs</key>
<true/>
</dict>
Updated about 1 month ago