SDK Integration
Step 1: Install React Native
Install Netmera
yarn add react-native-netmera
Link Netmera (for React Native versions < 0.60)
Skip this step if you are using React Native version 0.60 or greater.
react-native link react-native-netmera
For both native sides (Android & iOS), you don't have to include extra Netmera SDK libraries.
Step 2: 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.
Creating an APNS .p8 Certificate (Recommended)
Creating an APNS .p12 Certificate
2. Integrate & Initialize Netmera iOS SDK
Install Pods
Navigate to the iOS folder in your terminal and run:
$ pod install
Initialize Netmera in AppDelegate
AppDelegate
Netmera iOS SDK must be initialized in the AppDelegate file. Follow the steps based on your project type:
For Swift Projects: Modify your
AppDelegate.swift
file.For Objective-C Projects: Modify your
AppDelegate.m
andAppDelegate.h
files.
Modify your AppDelegate.swift
file:
import RNNetmera
import Netmera
@main
class AppDelegate: RCTAppDelegate, UNUserNotificationCenterDelegate, NetmeraPushDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self
}
// Enable logging (Optional: Set to false in production)
RNNetmera.logging(true)
// Initialize Netmera with your API Key
RNNetmera.initNetmera("<YOUR NETMERA API KEY>") // Replace with your API key
RNNetmera.setPushDelegate(self)
// Set App Group Name (Required for rich notifications)
Netmera.setAppGroupName("<YOUR APP GROUP NAME>") // Replace with your App Group Name
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
// MARK: - Push Notification Handling
@available(iOS 10.0, *)
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
let userInfo = response.notification.request.content.userInfo
if response.actionIdentifier == UNNotificationDismissActionIdentifier {
RNNetmeraRCTEventEmitter.onPushDismiss(["userInfo": userInfo])
} else if response.actionIdentifier == UNNotificationDefaultActionIdentifier {
RNNetmeraRCTEventEmitter.onPushOpen(["userInfo": userInfo])
}
completionHandler()
}
@available(iOS 10.0, *)
func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
completionHandler([.alert])
RNNetmeraRCTEventEmitter.onPushReceive(["userInfo": notification.request.content.userInfo])
}
override func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
RNNetmeraRCTEventEmitter.onPushRegister(["pushToken": deviceToken])
}
}
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.
React Native Push Handling
When triggering [RNNetmeraRCTEventEmitter onPushReceive]
in AppDelegate
, the corresponding method is called in React Native:
export const onPushReceive = async (message) => {
console.log("onPushReceive: ", message);
};
3. iOS10 Media Push Configuration
For versions 3.14.4 and above, complete the steps found in Media Push.
Update your
Podfile
by adding the following lines outside of your target:
pod "Netmera", "X.X.X-WithoutDependency"
pod "Netmera/NotificationServiceExtension", "X.X.X-WithoutDependency"
pod "Netmera/NotificationContentExtension", "X.X.X-WithoutDependency"
Replace X.X.X
with the latest version from the SDK Versions page > Changelog
Sample Project
Step 3: 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.gradle
File
Add the following to your project-level build.gradle
file:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:X.X.X'
classpath 'com.google.gms:google-services:X.X.X'
classpath 'com.huawei.agconnect:agcp:X.X.X.X'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://developer.huawei.com/repo/' }
maven { url "https://release.netmera.com/release/android" }
}
}
App’s
build.gradle
File
Add the required dependency and plugins to your app-level build.gradle
file:
dependencies {
implementation 'androidx.core:core:1.X.X'
}
At the top of your app’s
build.gradle
, include:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'
6. Initialize Netmera Android SDK
In your app, locate or create a class that extends
android.app.Application
and 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.xml
file under the<application>
tag using theandroid:name
Inside this class, add the following code to the
onCreate()
method
import com.netmera.reactnativesdk.RNNetmera;
import com.netmera.reactnativesdk.RNNetmeraConfiguration;
public class MainApplication extends Application implements ReactApplication {
@Override
public void onCreate() {
...
RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
.firebaseSenderId(<YOUR GCM SENDER ID>)
.huaweiSenderId(<YOUR HMS SENDER ID>)
.apiKey(<YOUR NETMERA API KEY>)
.logging(true) // Enables Netmera logs.
.build(this);
RNNetmera.initNetmera(netmeraConfiguration);
}
}
Step 4: Setup React Native
Complete Push Callback Methods
Implement the necessary push notification callback methods in your React Native project in the following page:
Step 5: Netmera SDK Push Notification Permission Methods
On iOS and Android 13+ devices, a runtime push notification permission request is required. You can use the following methods to check users' push notification status and request notification permission.
Request Push Notification Authorization
Netmera.requestPushNotificationAuthorization();
Check Notification Permission Status
This method allows checking whether the necessary permissions for the application have been obtained.
Netmera.checkNotificationPermission().then(status => {
//NotificationPermissionStatus.NotDetermined
//NotificationPermissionStatus.Blocked
//NotificationPermissionStatus.Denied
//NotificationPermissionStatus.Granted
});
React Native SDK Integration Complete
React Native SDK integration has been successfully completed, and your devices are now ready to receive the following types of push notifications sent via the Netmera Dashboard:
Standard Push Notifications
Interactive Push Notifications
Widgets
Push Notifications with Deeplinks
Last updated
Was this helpful?