Cordova

Things to keep handy before starting your integration with Apxor

Please have the following handy before beginning the integration:

Cordova Integration

Step 1: Getting started

Run the following command in your terminal from the project folder. This command will fetch the apxor plugins for you.

cordova plugin add cordova-plugin-apxor-sdk

Use registerDeeplinkHandler to listen on deeplink redirection from Apxor SDK and handle redirection logic (including external redirection) within application logic as follows

ApxorSDK.registerDeeplinkHandler((deeplinkUrl) => {
  // Whenever redirection happens from InApp notification buttons,
  // this callback will be executed.

  switch (deeplinkUrl) {
    case "scheme://about":
      // Redirect to About Component
      break;
    default:
      // Check if it's external URL and redirect to Browser
      break;
    // and so on
  }
});

Android Integration

Step 1: Add dependencies

Add plugin dependencies to your application build.gradle file

Path: <project>/<app-module>/build.gradle:

Check the latest release notes here.

1.1 ApxorSDK dependencies (mandatory)

1.2 Add exoplayer in your app (optional)

Add exoplayer in your app

Exoplayer enables you to configure Picture In Picture videos from the Apxor dashboard; if you are already using the exoplayer in your app, this step is not needed; otherwise, add the following dependency in the application build.gradle file. To use video pip templates, this is necessary.

For com.apxor.androidx:apxor-android-sdk-rtm:2.3.6@aar version onwards

For com.apxor.androidx:apxor-android-sdk-rtm:2.3.5@aar and below

Step 2: Add Proguard Rules

Note

If you use proguard to obfuscate the classes, you have to add the following to ignore obfuscation for Apxor SDK classes

Configure the below rules in your proguard-rules.pro file

Path: <project>/<app-module>/gradle.properties:

Note:

If you use androidx libraries, add the following property in gradle.properties file

Step 2: Initialize Apxor Android SDK

  • To Auto initialize SDK (Recommended), add following meta-data tag inside your application tag in your AndroidManifest.xml file

  • To manually initialize SDK, call ApxorSDK.initialize method in your Application class

Step 3: Enable uninstall tracking for your users [Optional]

Note

  • If you would like to track uninstalls, you must include apxor-android-sdk-push dependency in app/build.gradle file and corresponding JSON object in assets/plugins.json file

  • Apxor sends silent push notifications to track uninstalls. Please make sure you handle push notifications which will be sent with your SENDER_ID and ignore all notifications other than your SENDER_ID

Apxor uses your firebase server key to send silent push notifications to track uninstalls in order to measure outcomes of your campaign. To enable this please do the following :

Path : app/build.gradle

firebase-messaging version >= 22.0.0
  • Add the following dependency in your app/build.gradle

  • Add the following in plugins.json file

firebase-messaging version < 22.0.0
  • Add the following dependency in your app/build.gradle

  • If you are not using FirebaseMessagingService, you can skip this step. Otherwise, add the following

  • Add the following in plugins.json file

Read here on how to get your firebase sender ID and also FCM server key to share it with apxor to configure uninstall tracking.

Step 4: To view tooltips, Coachmark and Badges

Note

To anchor a tooltip or coachmark or badge to any UI element, this step is mandatory.

If you will only use In-app messages, this step can be skipped.

In your MainActivity onCreate method you must set the tag for the WebView as follows to view the tooltips.

Step 5: Ensuring ApxorSDK is initialised successfully

We have to verify for two things as follows :

SDK Initialisation

On running your android project lookout for the following log in logcat :

Plugin Initialisation

By default, only error logs are enabled. To see debug logs for plugin initialisation and to confirm tracking event triggers, user properties. Please run the below command in terminal

Note

Apxor uploads data only when the app is minimized to the background. If you are running from Android Studio (emulators or devices), do not stop the app, just press on the "home" button in order for data to be uploaded.

Step 6: Log data to set up triggers and measure goals

Now as we are done with basic integration, we can go ahead to setup event triggers, capture data for targeting and to personalize messaging.

Please follow the guide here to log user properties, events and event properties.

iOS integration

Initialize Apxor iOS SDK

  • To Auto initialize SDK, add the following inside your application plist file.

  • Open your application's Info.plist as source code.

  • Copy paste the below piece of code, to create an entry for ApxorSDK.

Configuring Test Device

  • First, you need to configure your app to ensure there is a URL Scheme with your application's bundle identifier as the value.

  • If your app already has a URL Scheme with your application's bundle identifier as the value, you can skip this step.

Configuring URL Scheme

  • To configure URL scheme, goto your project settings, select Targets. Click on the Info tab.

  • Select the URL Types, and click on the + button to add a new URL Scheme.

  • Add a new URL Scheme with your bundle identifier as the value.

  • Your bundle identifer will be in the format, com.xxxx.xxxx

  • Use the image below for reference.

Note

Make sure the URL scheme has the value of your bundle identifier that was provided in the dashboard while registering with us. Also, the app must have same bundle identifier.

Using AppDelegate
  • You'd need to enable Apxor to handle Apxor specific deeplinks.

  • In your application's AppDelegate file, in the function application(_:open:options:), add the following code at the beginning,

  • This will ensure the Apxor specific deep links are handle by our SDK.

Using SceneDelegate
  • You'd need to enable Apxor to handle Apxor specific deeplinks.

  • In your application's SceneDelegate file, add the following code at the beginning,

To show tooltips

  • In your MainViewController (the ViewController extending the CDVViewController) init method you must set the tag for the WebView as follows to view the tooltips.

Note

Ensure your webview isn't null and the TAG is set correctly.

  • You have to init the APXWKScriptHandler and call registerEventsAndScripts method to make sure any the calls made in the webview are taken care by the native SDK. It's as follows,

    • Now, add the following to the init method of your webview

  • Here's how to do the same thing in objective-C.

    • Make sure there's a proper WKUserContentController set to your WkWebView, if not please init it and use that config to initialise your WKWebView.

Ensuring ApxoriOSSDK is initialised successfully

  • Lookout for the following log in console output,

Note

Apxor uploads data only when the app is minimized to the background. If you are running from XCode (emulators or devices), do not stop the app, just press on the "home" button in order for data to be uploaded.

Additional features API Guide

Click here for guides to log user properties, events and event properties.

Last updated