SDK Integration
Example Project
For a practical example, check out the Netmera React Native Example Project on GitHub, which shows how to integrate the React Native SDK.
Step 1: Install React Native
Install Netmera
Link Netmera (for React Native versions < 0.60)
Skip this step if you are using React Native version 0.60 or greater.
For both native sides (Android & iOS), you don't have to include extra Netmera SDK libraries.
Step 2: Setup Android
1. Netmera Android Onboarding
In Netmera Panel:
Navigate to Developers > Netmera Onboarding.
Select Android and click Start to proceed.

2. Create a Firebase Configuration
Netmera uses Firebase Cloud Messaging (FCM) for delivering push notifications.
Go to the Firebase Developers Console and create a Firebase project.
Generate a new Private Key (JSON file) for your project.
Upload this file in Netmera Panel > Developers > Netmera Onboarding > Android > Step 2: Create A Firebase Configuration > FCM Service Account Key.
3. Select a Target SDK
Choose the React Native SDK based on your application framework.

4. Integrate and Initialize React Native SDK
Important Notes:
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.
5. Integrate Netmera Android SDK
Netmera Android SDK is available through the Maven repository. Add the following configurations to your build.gradle file. The AndroidManifest and other resource settings are automatically managed by the Android Gradle build tool.
Gradle Configuration
Project’s
build.gradleFile
Add the following to your project-level build.gradle file:
At the top of your app’s
build.gradle, include:
Important Note for Obfuscation:
If your code is obfuscated, there is no need to add any special rules for Netmera. Its functionality is unaffected by code obfuscation.
6. Initialize Netmera Android SDK
In your app, locate a class that extends
android.app.Applicationand implementscom.facebook.react.ReactApplication
If you don’t have a class that extends android.app.Application
If you don’t have this class, create one.
Then, add it to your
AndroidManifest.xmlfile under the<application>tag using theandroid:name
Inside this class, add the following code to the
onCreate()methodReplace
<YOUR GCM SENDER ID>,<YOUR HMS SENDER ID>, and<YOUR NETMERA API KEY>with your actual values.
Step 3: Setup iOS
1. Create an Apple Push Notification Certificate
Log in to developer.apple.com with your Apple Developer account.
Generate an Apple Push Notification Certificate for your app.
Export the certificate using Keychain Access on your Mac.
Upload the exported certificate to the Netmera panel by navigating to Developer > Push Backends > iOS in the left menu.
Bundle IDs should match on your project, certificate and panel:
Ensure that the certificate you upload to the panel matches the bundle ID of your project. Additionally, set your project's bundle ID in the panel to ensure consistency. The bundle ID of your project, the certificate, and the one specified in the panel must all align.
Certificate types:
For apps downloaded from the App Store or tested via TestFlight, the certificate type should be set to "prod".
For apps built directly from Xcode, the certificate type must be set to "dev".
If you have problems sending push notifications when you build from Xcode, verify the certificate type on the Developer > Push Backends > iOS page in Panel.
Creating an APNS .p8 Certificate (Recommended)
Creating an APNS .p12 Certificate
2. Configure Podfile
Add the following post_install block to the end of your Podfile.
If you are using the New Architecture or using Firebase as static frameworks, add the following lines right before the post_install block.
3. Install Pods
Navigate to the iOS folder in your terminal and run:
4. Add Netmera-Config.plist
Add the `Netmera-Config.plist` file to your ios/your_app directory.
If you are using Netmera on-premises, you must add your server URL as the base_url key inside sdk_params.
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.
Use this key to replace the YOUR-SDK-API-KEY placeholder in the sample code.
5. Configure Xcode Push Notifications Settings
Open your project in Xcode.
Navigate to Signing & Capabilities.
Click + Capability and select Push Notifications.
Click + Capability and select Background Modes then enable Background fetch and Remote notifications modes.

6. Initialize Netmera in AppDelegate
AppDelegateInitialize the Netmera Swift SDK by adding the following lines to your AppDelegate file:
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.
Use this key to replace the <YOUR NETMERA API KEY> placeholder in the sample code.
Configuring Multiple Environments
If you want to configure multiple environments for your app (e.g., Development and Production), follow the steps below using the Overwrite Method. This method ensures that the configuration is correctly applied to both the Main App and any App Extensions (e.g., Notification Service).
Step 1: Prepare Your Files
Create a base
Netmera-Config.plistin your project folder.In the Target Membership panel, check your Main App and all Extensions.
Add your environment-specific files (e.g.,
Netmera-Config-Debug.plistandNetmera-Config-Release.plist) to your project folder.
Step 2: Add Run Script Phase
In Xcode, select your Main App Target.
Go to the Build Phases tab and add a New Run Script Phase.
Position this phase before the Copy Bundle Resources step.
Implement the following script:
Note for Extensions: If your project includes extensions, ensure that only the base Netmera-Config.plist (the one being overwritten) is included in the Target Membership of those extensions. The Debug and Release source files should remain exclusive to the project folder or the main app target.
Last updated
Was this helpful?