SDK Integration
Last updated
Was this helpful?
Last updated
Was this helpful?
We strongly recommend you to integrate with our new Swift SDK by referring to the guide on SDK Integration for incorporating Netmera into your projects.
The previous iOS SDK integration method, which you can find here, is being phased out and will not be supported in the long term. Transitioning to the new SDK will ensure that you have access to the latest features, improvements, and technical support.
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.
We send push notifications using APNS (Apple Push Notification Service). Therefore, you need to obtain an Apple Push Notification Certificate from www.developer.apple.com using your account. Once you have the certificate, you should export it using Keychain Access and add it to the iOS page in the panel's left menu under Developer > Push Backends > iOS.
Using the APNS .p8
certificate is highly recommended for the following reasons:
The .p8 certificate is mandatory for enabling features such as Live Activities.
Unlike .p12 certificates, a single .p8 certificate can manage push notifications for multiple applications, simplifying certificate management across projects.
The .p8 certificate does not require yearly renewal, reducing administrative overhead compared to .p12 certificates.
The .p8 certificate is easier to generate via the Apple Developer Portal and only needs to be downloaded once.
Important Notes on Bundle ID:
Make sure to add the certificate generated with the bundle ID of your project to the panel, and set the bundle ID of your project in the panel as well. The bundle ID of your project, the bundle ID of the certificate, and the bundle ID set in the panel should all match.
In case of having problems sending push notifications when you build from Xcode:
Check the certificate type on the Developer > Backend Transfer > iOS page in the menu on the left. If you downloaded the app from the store or are testing it via TestFlight, the certificate type must be "prod". If you are compiling from Xcode, the certificate type must be selected as "dev".
The preferred method for integrating Netmera into your project is through CocoaPods. CocoaPods simplifies dependency management, making the integration process more efficient. However, if you prefer not to use CocoaPods, manual integration is also an option.
Open your project's Podfile
. Add the following line to include the Netmera SDK:
For projects without AdId support, use the following:
If you choose not to use CocoaPods, you can manually integrate Netmera into your project. Follow the instructions below to complete this process.
Add the following code to your AppDelegate
class.
Netmera.setLogLevel(NetmeraLogLevel.debug)
This method controls the level of logging for Netmera and is optional based on your requirements. There are three log levels to choose from:
debug: Logs detailed information for debugging purposes. Ideal for tracking the flow of events in your app.
error: Displays only error logs, helping you focus on issues and errors.
none: Disables logging for Netmera, providing a clean output without any Netmera-specific logs.
You can select the appropriate log level according to your development needs. This method is optional and should be used based on whether you want to monitor Netmera's logs.
Important Notes:
Make sure to obtain the API key from the relevant panel. To get the YOUR_SDK_API_KEY
, navigate to Developers > API > SDK API Key in your web panel.
If you're working with an on-premise installation, ensure you call the Netmera.setBaseURL("YOUR PANEL DOMAIN URL")
method before setting the API key.
To request push notification authorization from the user, call the following method:
Calling this method will immediately trigger the push notification permission dialog to appear to the user.
Make sure to call this method after informing the user about how your application will use push notifications.
If push permission has already been requested from Apple or another push provider, you should call this method within that request. Otherwise, interactive push buttons will not be handled by the Netmera SDK.
You can use the isEnabled
method to determine if the user has granted permission for notifications. This will help you assess whether the push notification functionality is available.
Open your project in Xcode.
Navigate to Signing & Capabilities.
Under Capabilities, add Push Notifications to your app.
This enables the necessary configurations for push notifications in your application.
The Netmera SDK provides methods to manage email subscription preferences for your users.
1. Check Email Subscription Status
Use the following method to check if the user has allowed email subscriptions:
Returns: A Boolean
value (true
if the user has allowed email subscriptions, otherwise false
).
2. Update Email Subscription Preferences
Set the user's preference for email subscriptions using one of the methods below:
Allow Email Subscriptions
Disallow Email Subscriptions
These methods enable you to respect user preferences for email communications within your application.
iOS 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
If you are sending push notifications from the Netmera Dashboard but not receiving them on your devices, please refer to Apple's Technical Note about Troubleshooting Push Notifications.