Docs

Docs

  • Guides
  • Integrations

›Integration

API Guide

  • Android
  • iOS
  • Web
  • React Native
  • Cordova

Integration

  • Android SDK (androidx)
  • Android SDK
  • Android SDK (Staging)
  • iOS SDK
  • iOS SDK (Staging)
  • iOS SDK (Manual)
  • iOS Push Notifications
  • Web SDK
  • React Native SDK
  • Cordova SDK

Performance

  • Android
  • iOS

Third Party Support

  • Tracking Third Party
  • Firebase
  • Clevertap
  • Moengage
  • Webengage
  • Segment
  • Appsflyer
  • Branch

Release Notes

  • Android
  • iOS

APXOR Android SDK Integration Guide

Getting started with Apxor Android SDK

Plugin NameLatest VersionRelease Date
apxor-android-sdk-rtm2.1.82023-07-04
apxor-android-sdk-qe1.5.82023-07-04
apxor-android-sdk-core2.9.32023-07-04
surveys1.3.92023-07-04
wysiwyg1.3.82023-07-04
apxor-android-sdk-push1.2.92023-07-04
jit-log1.0.02020-10-28
apxor-android-crash-reporter1.0.52019-05-01
  1. Add Maven URL in root level build.gradle

    allprojects {
        repositories {
            // ...
            maven {
               url "https://repo.apxor.com/artifactory/list/libs-release-android/"
            }
            // ...
        }
    }
    
  2. Add Apxor Android SDK to your App

    // ...
    apply plugin: 'com.android.application'
    
    android {
        // ...
        defaultConfig {
            minSdkVersion 16 // Minimum Sdk version must be 16 and above
            // ...
        }
        // ...
    }
    
    dependencies {
        // ...
    
        // Event tracking and a must have dependency for other plugins
        implementation 'com.apxor.androidx:apxor-android-sdk-core:2.9.3@aar'
    
        // Getting a "Could not find" error? Make sure that you've added
        // Apxor's Maven repository to your root-level build.gradle file
    }
    
  3. If you use proguard, add the following in your proguard-rules.pro file

    -keep class com.apxor.** { *; }
    -dontwarn com.apxor.**
    
  4. If you are using rtm >= 1.7.1, add the following property in gradle.properties file

    android.enableDexingArtifactTransform = false
    
  5. If you are using rtm >= 1.7.1, for Video InApps add the following dependency in application build.gradle file

    dependendies {
         implementation 'com.google.android.exoplayer:exoplayer:2.14.0'
    }
    

Initialize Apxor Android SDK

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

    <application>
        <!-- You must replace with your app id shared by apxor in android:value attribute -->
        <meta-data android:name="APXOR_APP_ID" android:value="APP_ID" />
    </application>
    
  2. To manually initialize SDK, call ApxorSDK.initialize method in your Applicaiton class

    //...
    import com.apxor.androidsdk.core.ApxorSDK;
    
    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            // ...
            ApxorSDK.initialize(<YOUR_APP_ID>, this.getApplicationContext());
        }
    }
    

    Note

    To get your app ID, please contact us at contact@apxor.com

Plugins integration

  1. Add apxor-android-sdk-core dependency in app/build.gradle file

  2. Add plugin dependencies to your application build.gradle file

    dependendies {
    
        // Add these for Realtime Actions and Surveys
        implementation 'com.apxor.androidx:apxor-android-sdk-qe:1.5.8@aar'
        implementation 'com.apxor.androidx:apxor-android-sdk-rtm:2.1.8@aar'
        implementation 'com.apxor.androidx:surveys:1.3.9@aar'
    
        // Add this to track application crashes
        implementation 'com.apxor.androidx:apxor-android-crash-reporter:1.0.5@aar'
    
        // Helper plugin to create walkthroughs
        implementation 'com.apxor.androidx:wysiwyg:1.3.8@aar'
    
        // Add this to log events without attributes at runtime
        implementation 'com.apxor.androidx:jit-log:1.0.0@aar'
    
        // Getting a "Could not find" error? Make sure that you've added
        // Apxor's Maven repository to your root-level build.gradle file
    }
    
  3. Create plugins.json file in your assets folder (usual path is src/main/assets/plugins.json) and add required JSON configs in it.

    For every plugin dependency you add in dependencies section, there will be a corresponding entry in this file.

    • If an entry for plugin exists in this file and the corresponding dependency doesn't exist in the dependencies section of app/build.gradle file, the SDK silently throws a ClassNotFoundException error log in logcat
    • If the dependency exists in dependencies section of app/build.gradle file and the corresponding entry doesn't exist in this file, that plugin will not initialize at runtime.
    {
      "plugins": [
        {
          "name": "rtm",
          "class": "com.apxor.androidsdk.plugins.realtimeui.ApxorRealtimeUIPlugin"
        },
        {
          "name": "crash",
          "class": "com.apxor.androidsdk.plugins.crash.CrashReporterPlugin"
        },
        {
          "name": "surveys",
          "class": "com.apxor.androidsdk.plugins.survey.SurveyPlugin"
        },
        {
          "name": "wysiwyg",
          "class": "com.apxor.androidsdk.plugins.wysiwyg.WYSIWYGPlugin"
        },
        {
          "name": "jitlog",
          "class": "com.apxor.androidsdk.plugins.jitlog.ApxorJITLogPlugin"
        }
      ]
    }
    

    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
  4. Enable Apxor Push notifications [Optional]

    If you are using firebase-messaging version < 22.0.0, follow below steps

    1. Add the following dependency in your app/build.gradle

      dependencies {
        // Add this to track uninstalls and send push notifications from Apxor dashboard
        implementation('com.apxor.androidx:apxor-android-sdk-push:1.2.9@aar') {
          exclude group: 'com.google.firebase'
        }
      }
      
    2. If you are not using FirebaseMessagingService, you can skip this step. Otherwise, add the following

      public class MyFirebaseMessagingService extends FirebaseMessagingService {
          @Override
          public void onMessageReceived(RemoteMessage remoteMessage) {
              // Creating Notification Channel
              ApxorPushAPI.createNotificationChannel(this.getApplicationContext(), "Apxor", "Apxor", "Apxor");
              if (remoteMessage.getFrom().equals(YOUR_FCM_SENDER_ID)) {
                  // Push Notification receiver with your Sender Id
              } else {
                  // Check if Push Notification received from Apxor
                  if (ApxorPushAPI.isApxorNotification(remoteMessage)) {
                      ApxorPushAPI.handleNotification(remoteMessage, getApplicationContext());
                  } else {
                      // Silent or Data push notification which you can send through Apxor dashboard
                  }
              }
          }
      }
      
    3. Add the following in plugins.json file

      {
        "plugins": [
          {
            "name": "push",
            "class": "com.apxor.androidsdk.plugins.push.PushPlugin"
          }
        ]
      }
      

    If you are using firebase-messaging version >= 22.0.0, follow below steps

    1. Add the following dependency in your app/build.gradle

      dependencies {
        // Add this to track uninstalls and send push notifications from Apxor dashboard
        implementation('com.apxor.androidx:apxor-android-sdk-push-v2:1.2.9@aar') {
          exclude group: 'com.google.firebase'
        }
      }
      
    2. Add the following in plugins.json file

      {
        "plugins": [
          {
            "name": "push",
            "class": "com.apxor.androidsdk.plugins.push.v2.PushPlugin"
          }
        ]
      }
      

Ensuring ApxorSDK is initialised successfully

  • Lookout for the following log in logcat,

    ApxorSDK(v2**) successfully initialized for: APP_ID
    
  • By default, only error logs are enabled. To see debug logs, run the below command in terminal

    adb shell setprop log.tag.Apxor VERBOSE
    

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.

API Guide

Read API Guide here

← CordovaAndroid SDK →
  • Getting started with Apxor Android SDK
  • Initialize Apxor Android SDK
  • Plugins integration
  • Ensuring ApxorSDK is initialised successfully
  • API Guide
Integrations
AndroidiOSWeb
API Guide
AndroidiOSWeb
Apxor
Copyright © 2023 Apxor Technology Solutions Pvt. Ltd.