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. Integrate & Initialize Netmera iOS SDK
Install Pods
Navigate to the iOS folder in your terminal and run:
$ pod install
Initialize Netmera in 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 and AppDelegate.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.
For projects using Objective-C, update both AppDelegate.h and AppDelegate.m as follows
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.
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 testpanel 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:
HmsPushEvent.onRemoteMessageReceived(event => {
const remoteMessage = new RNRemoteMessage(event.msg);
let data = JSON.parse(remoteMessage.getData());
console.log("onRemoteMessageReceived", data);
if (Netmera.isNetmeraRemoteMessage(data)) {
Netmera.onNetmeraHuaweiPushMessageReceived(remoteMessage.getFrom(), data);
}
});
Handle Background Huawei Messages
HmsPushMessaging.setBackgroundMessageHandler((dataMessage) => {
const remoteMessage = new RNRemoteMessage(dataMessage);
let data = JSON.parse(remoteMessage.getData());
if (Netmera.isNetmeraRemoteMessage(data)) {
Netmera.onNetmeraHuaweiPushMessageReceived(remoteMessage.getFrom(), data);
}
});
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.
Check Notification Permission Status
Netmera.checkNotificationPermission().then((status) => {
switch (status) {
case NotificationPermissionStatus.NotDetermined:
// Not Determined
break;
case NotificationPermissionStatus.Blocked:
// Blocked
break;
case NotificationPermissionStatus.Denied:
// Denied
break;
case NotificationPermissionStatus.Granted:
// Granted
break;
default:
break;
}
});
Request Push Notification Authorization
Netmera.requestPushNotificationAuthorization();
Push Enable/Disable User Flow:
Granting Permission:
The user triggers requestPushNotificationAuthorization(), and if they grant permission, a push enable request is sent.
Handling Denial:
If the user denies permission, avoid resending the request immediately (as recommended by Google). Instead, the SDK opens the app's notification settings. The user can grant permission from the settings and return to the app, where a push enable request is sent.
Denying Permission:
If the user triggers requestPushNotificationAuthorization() and denies permission, a push disable request is sent.
Reattempt After Denial:
If denied, avoid immediate re-request. The SDK will open the app's notification settings. If the user cancels (presses the back button), a push disable request is sent.
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: