Comment on page
🔜
Beta SDK Integration
Quick Steps Guidelines
Step 1: Integrate SDK into Your Project
Add Netmera to your Podfile and run pod install command in your terminal.
Step 2: Setup Netmera
Import the Netmera framework in your AppDelegate.swift file and initialize Netmera in your app.
Step 3: Request Push Notification Authorization
In your pod file, add NetmeraNotification and request push notification authorization from user.
Step 4: Enable Push Notifications
Enable push notifications for your app by navigating to Signing & Capabilities > Capability > Push Notifications on Xcode.
Swift SDK integration completed
👏
Beta SDK is currently in the production phase and will be released soon. We are working diligently to finalize it and make it available for you to use.
- 1.Add Netmera to your Podfile.
pod "NetmeraAnalytic" // to use Netmera analytic features
pod "NetmeraAnalyticAutotracking" // to use auto tracking features
pod "NetmeraNotification" // to use Netmera push notification features
pod "NetmeraAdvertisingId" // to use Netmera advertising identifier features
pod "NetmeraLocation" // to use Netmera location features
pod "NetmeraGeofence" // to use Netmera geofence features
pod "NetmeraNotificationInbox" // to use Netmera push inbox features
- 2.Run
pod install
command in your terminal.
- 1.Import the Netmera framework in your AppDelegate.swift file.
import NetmeraAnalytic
import NetmeraNotification
import NetmeraLocation
import NetmeraNotificationInbox
import NetmeraAdvertisingId
- 2.Initialize Netmera in your App. There are two ways to initialize Netmera.
Configure with Plist. Add Netmera-Config.plist file to your project. Copy the following code into the Plist file and replacing the
API_KEY
placeholders with your actual API Key value.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>sdk_params</key>
<dict>
<key>app_group_name</key>
<string>{AppGroupName}</string>
<key>use_ui_scene</key>
<false/>
<key>api_key</key>
<string>{API_KEY}</string>
<key>base_url</key>
<string>{BaseURL}</string>
<key>custom_events</key>
<array>
<string>{YourCustomEvent}</string>
</array>
</dict>
<key>location_max_active_region</key>
<string></string>
<key>in_app_message_settings</key>
<dict>
<key>TextColor</key>
<string>{hexcolor. For ex-> 16777215}</string>
<key>TitleColor</key>
<string>{hexcolor. For ex-> 16777215}</string>
<key>BackgroundColor</key>
<string>{hexcolor. For ex-> 16777215}</string>
<key>CancelButtonBackgroundColor</key>
<string>{hexcolor. For ex-> 16777215}</string>
<key>TitleFont</key>
<string>{font family name. ex -> ariel}</string>
<key>TextFont</key>
<string>{font family name. ex -> ariel}</string>
<key>CancelButtonRadius</key>
<string>{10 sd px}</string>
<key>ShadowOpacity</key>
<string>{0-1}</string>
<key>BottomPaddingRatio</key>
<string>{between 0.01 - 1}</string>
<key>CancelButtonImage</key>
<string>{imagename}</string>
</dict>
<key>blacklist_screen_names</key>
<array/>
</dict>
</plist>
Call Netmera initialize method in your
application(_:didFinishLaunchingWithOptions:)
method.Netmera.initialize()
Add the following code to your
application(_:didFinishLaunchingWithOptions:)
method, replacing the API_KEY
placeholders with your actual API Key values,let netmeraParams = NetmeraParams(
apiKey: "SDK_API_KEY",
baseUrl: "", // Optional; For On-premise setup
appGroupName: "", // Optional; to use carousel&slider push
customEvents: [CustomLoginEvent.self] // Optional; give list of all custom event class type
)
Netmera.initialize(params: netmeraParams)
Netmera.setLogLevel(.debug) // Options can be .debug, .info, .error, .fault
Please make sure you get the API key value from the relevant panel⚠YOUR_SDK_API_KEY: You can get that api key from Developers -> API -> SDK API Key from your web panel.
In your pod file, you should add
NetmeraNotification
and install to your app target like the following.pod "NetmeraNotification"
Request push notification authorization from user by calling the following method in an appropriate place.
Netmera.requestPushNotificationAuthorization(for: [.alert, .badge, .sound])
Essential to Inform the User:
When calling this method, it will promptly trigger the push notification permission dialog for the user. Therefore, it's essential to invoke this method after informing the user about how your application will utilize push notifications.
Important Note:
If you receive a push permission request from a push provider like Apple, it's crucial to call the appropriate method. This ensures that the Netmera SDK can correctly handle interactive push notification buttons. Failing to do so may result in these buttons not being properly managed by the SDK.
Enable push notifications for your app by navigating to,
Signing & Capabilities > Capability > Push Notifications in Xcode.

//in didFinishLaunchingWithOptions
// ‼️ Implement UNUserNotificationCenterDelegate methods in AppDelegate
UNUserNotificationCenter.current().delegate = self
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
//
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
//
}
Swift 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:
- 1.Standard Push Notifications
- 2.Interactive Push Notifications (If you've configured and published them using the Dashboard)
- 3.Push Notifications with Web View Content
- 4.Push Notifications with Deeplinks (If your application supports URL Scheme-based deeplinks and you've configured the application's URL Scheme in the Dashboard.)
Last modified 1mo ago