-
Notifications
You must be signed in to change notification settings - Fork 4
Additional Yandex Mobile Ads steps
Yandex App Metrics will be added along with Yandex Ads SDK.
Important
You should take into account some features of the AppMetrica library during initialization.
For more information, see Features of the AppMetrica library.
Warning
The code in the Application.onCreate()
method runs multiple times for each processes.
If you encounter an initialization error after integrating a third-party library, make sure that the third-party library is initialized only in the main process.
Note
The CAS SDK automatically initializes the Yandex Mobile Ads SDK, and the Yandex Mobile Ads SDK activates AppMetrica for its operation. Additionally, the CAS SDK automatically initializes Firebase Analytics for collecting ad_impression events.
When the CAS SDK initializes the Yandex Mobile Ads SDK before initializing Firebase Analytics, it leads to a crash in the app.
When using Firebase Performance Monitoring in Firebase version 31.0.0+, activate FirebaseApp for all processes, including the AppMetrica SDK process. In Application#onCreate()
, call FirebaseApp.initializeApp(this)
before activating the AppMetrica SDK. Otherwise, the AppMetrica SDK won't be activated.
class YourApplication extends Application {
@Override
public void onCreate() {
super.onCreate()
// if app use FirebaseApp then init it first for all processes
FirebaseApp.initializeApp(this)
// if app use AppMetrica then activate it for all processes
AppMetricaConfig config = AppMetricaConfig.newConfigBuilder(API_KEY).build();
AppMetrica.activate(this, config);
if (CASUtilities.isMainProcess(this)) {
// Before user finishes the consent flow
// Initializing third-party SDKs for main process only
// Initialize CAS
CAS.buildManager()
.withCompletionListener(config -> {
// After the user finishes the consent flow
// Initializing third-party SDKs for all processes
if (CASUtilities.isMainProcess(this)) {
// Initializing thrid-party SDKs for main process only
}
}
.initialize();
}
}
}
Tip
- Se also AppMetrica Error descriptions on developer docs.
- Read more about CAS initialization.
If you need to disable geo, for example, for certain app categories to meet Google Play policies, read how exclude location dependencies on AppMetrica developer docs.
- Project Setup
- Advanced integration
- Additional mediation steps
- Link the project
- App-ads.txt🔗