For the complete documentation index, see llms.txt. This page is also available as Markdown.

Migration to 4.x

This guide outlines the steps required to migrate your Android integration from Netmera SDK 3.x to 4.x.

SDK 4.0.0 introduces key improvements and breaking changes in the initialization flow:

  • androidx.startup dependency removed: The SDK no longer uses androidx.startup for bootstrapping.

  • Asynchronous Initialization: Netmera.init() now handles threading internally and executes on a background thread. You no longer need to dispatch it yourself.

  • Centralized Provider Registration: Providers are now registered directly via NetmeraConfiguration.Builder instead of AppInitializer.

Step 1: Update Dependencies

Open your app-level build.gradle (or build.gradle.kts) file and update the Netmera dependencies to the latest 4.x.x versions.

// build.gradle (Module: app)

dependencies {
    // Before (3.x)
    // implementation 'com.netmera:nmcore:3.x.x'
    // implementation 'com.netmera:nmfcm:3.x.x'
    // implementation 'com.netmera:nmhms:3.x.x'

    // After (4.x)
    implementation 'com.netmera:nmcore:4.x.x'
    implementation 'com.netmera:nmfcm:4.x.x'   // If using FCM (Firebase)
    implementation 'com.netmera:nmhms:4.x.x'   // If using HMS (Huawei)
}

Please check the latest Netmera Changelog to find the exact latest version suitable for your project.

Step 2: Register NMActivityLifecycleCallbacks

In your custom Application.onCreate(), you must register the SDK's lifecycle callbacks before calling Netmera.init().

Step 3: Register Providers via NetmeraConfiguration.Builder

Providers are no longer managed separately via AndroidX AppInitializer. Add them directly into the configuration builder using the .addProvider() method.

Only add the providers your application actually utilizes. If your application targets Google Play Devices exclusively, you can safely omit NMHMSProvider().

Step 4: Remove Manual Startup Infrastructure

In SDK 3.x, the following setup lines were required for applications that had explicitly disabled auto-startup to drive the initialization sequence manually. Since the lifecycle has changed in 4.x, remove these lines completely if they exist in your Application class:

Before / After Code Summary

Here is a side-by-side structural comparison of the changes in your Application.onCreate() method:

❌ 3.x Implementation (Legacy)

4.x Implementation (Modernized)

Last updated

Was this helpful?