SDK Integration
Onboarding Checklist: Android
Please find the Onboarding Checklist for iOS and Android below. Follow the titles in the checklist to ensure you have completed each essential step in your onboarding process with Netmera.
Step 1: Select a Platform
Navigate to Developers > Netmera Onboarding.
Select Android and click Start to proceed.

Step 2: Create a Firebase Configuration
Netmera uses Firebase Cloud Messaging (FCM) for delivering push notifications.
Go to the Firebase Developers Console and create a new project.
Generate a new Private Key (JSON file) for your project.
Upload the JSON file you downloaded from Firebase Cloud Messaging to the
Project > app-level rootdirectory.

Choose one of the four options: Node.js, Java, Python, and Go. The choice of option does not require any action. Simply click the 'Generate New Private Key' button to download the file. No further selections are needed.

Upload this file in Netmera Panel > Developers > Netmera Onboarding > Android > Step 2: Create A Firebase Configuration > FCM Service Account Key.

Step 3: Select a Target SDK
Select the SDK for your application development framework as Native Android.

Step 4: Integrate Netmera SDK
Important Notes on SDK API Key:
Do not use the API key from a test panel in production.
Each panel has a unique API key, and using the wrong one can result in data misdirection or errors.
To obtain your SDK API Key:
Go to the Netmera Panel.
Navigate to Developer > API > SDK API Key.
Copy your SDK API Key from this section.
Standard Gradle
If your project is using Standard Gradle:
Add the following snippets to integrate the Netmera SDK into your project.
In this step, only copy the url specified below and add it to maven.
You should add Netmera dependency to your dependencies section in your: build.gradle(:app)
Check Changelog to find the SDK versions listed as '4.x.x' below.
Netmera BOM (Bill of Materials) Support
BOM support is available starting from version 4.5.0.
Using the BOM allows you to manage Netmera SDK versions more easily and ensures compatibility between nmcore, nmfcm, and nmhms modules.
Gradle Version Catalogs
If your project is using Gradle Version Catalogs:
Add the following snippets to integrate the Netmera SDK into your project.
Kotlin
If you want to integrate Huawei Mobile Services (HMS), add the following configuration to your build.gradle file before plugins. Following part is only for Huawei integration.
For more information, visit the following link: Huawei AppGallery Connect Guide.
Note: Check your libs.versions.toml file:
This file is usually located within the
gradlefolder in the root directory of your project.Review how the relevant plugin is defined.
Netmera BOM (Bill of Materials) Support
BOM support is available starting from version 4.5.0.
Using the BOM allows you to manage Netmera SDK versions more easily and ensures compatibility between nmcore, nmfcm, and nmhms modules.
In this step, only copy the url "https://release.netmera.com/release/android" and add it to maven.
Check Changelog to find the SDK versions listed as '4.x.x' below.
Netmera BOM (Bill of Materials) Support
BOM support is available starting from version 4.5.0.
Using the BOM allows you to manage Netmera SDK versions more easily and ensures compatibility between nmcore, nmfcm, and nmhms modules.
Groovy
If you want to integrate Huawei Mobile Services (HMS), add the following configuration to your build.gradle file before plugins. Following part is only for Huawei integration.
For more information, visit the following link: Huawei AppGallery Connect Guide.
Note: Check your libs.versions.toml file:
This file is usually located within the
gradlefolder in the root directory of your project.Review how the relevant plugin is defined.
Netmera BOM (Bill of Materials) Support
BOM support is available starting from version 4.5.0.
Using the BOM allows you to manage Netmera SDK versions more easily and ensures compatibility between nmcore, nmfcm, and nmhms modules.
In this step, only copy the url "https://release.netmera.com/release/android" and add it to maven.
Check Changelog to find the SDK versions listed as '4.x.x' below.
Netmera BOM (Bill of Materials) Support
BOM support is available starting from version 4.5.0.
Using the BOM allows you to manage Netmera SDK versions more easily and ensures compatibility between nmcore, nmfcm, and nmhms modules.
Step 5: Initialize Netmera SDK
Initialize Netmera SDK
Add the following initialization code inside the
onCreate()method of yourApplicationclass.
If Application Class is Not Already Present:
Create an Application Class If your project doesn't yet have an
Applicationclass, create one and include the initialization code as shown below.Update AndroidManifest.xml In the
AndroidManifest.xml, add yourApplicationclass by specifyingandroid:namein the<application>tag.To exclude Netmera Android SDK files from auto-backup if your app supports backup, please see the relevant title Q10: Excluding Netmera Android SDK files from auto-backup if your app supports backup.
registerActivityLifecycleCallbacks method must be called in the Main Thread.
registerActivityLifecycleCallbacks method must be called in the Main Thread.
Configuring baseUrl for On-Premise Applications
For On-Premise Applications: Include the following code to configure the base URL and API key:
For Non-On-Premise Applications: Only the API key needs to be configured:
Optional: Initialization Callback
To implement the initialization callback:
Add the following code to handle success and failure:
Optional: Enable Logging
Use logging only for debugging. Set .logging(true) during development and .logging(false) before release.
If your app uses a custom FirebaseMessagingService or HmsMessageService, review Custom FCM Implementation and Custom HMS Implementation before completing the integration.
Important Note for Obfuscation:
No special obfuscation rules are needed for Netmera. Its functionality remains unaffected, even with code obfuscation enabled.
Android SDK Integration Complete
The Android SDK integration has been successfully completed, and your devices are now set to receive the following types of push notifications via the Netmera Dashboard:
Standard Push Notifications
Interactive Push Notifications
Widgets
Push Notifications with Deeplinks
Warning During App Store Submission:
When submitting your application to the App Store, you might encounter the com.google.android.gms.permission.AD_ID alert. Here’s how to handle it:
Choose 'Yes' when prompted.
On the subsequent page, make sure the 'analytics' option is selected.
After this, no further additions to the manifest are required; simply merging the manifest will suffice.
Last updated
Was this helpful?