Additional Yandex Mobile Ads steps - cleveradssolutions/CAS-Android GitHub Wiki

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]

Excluding geo from the list of dependencies

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.