APXOR Android SDK Integration Guide for Staging environment
Getting started with Apxor Android SDK
Plugin Name | Latest Version | Release Date |
---|---|---|
staging-core | 2.7.7 | 2021-08-12 |
staging-push | 1.2.5 | 2021-08-12 |
staging-qe | 1.4.3 | 2021-08-12 |
staging-rtm | 1.7.0 | 2021-08-12 |
staging-surveys | 1.3.1 | 2021-08-12 |
staging-wysiwyg | 1.1.9 | 2021-08-12 |
staging-jit-log | 1.0.0 | 2021-08-12 |
staging-crash-reporter | 1.0.5 | 2021-08-12 |
Add Maven URL in root level
build.gradle
allprojects { repositories { // ... maven { url "https://repo.apxor.com/artifactory/list/libs-release-android/" } // ... } }
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:staging-core:2.7.7@aar' // Getting a "Could not find" error? Make sure that you've added // Apxor's Maven repository to your root-level build.gradle file }
If you use proguard, add the following in your
proguard-rules.pro
file-keep class com.apxor.** { *; } -dontwarn com.apxor.**
Initialize Apxor Android SDK
To Auto initialize SDK (Recommended), add following
meta-data
tag inside yourapplication
tag in yourAndroidManifest.xml
file<application> <!-- You must replace your app in android:value attribute --> <meta-data android:name="APXOR_APP_ID" android:value="APP_ID" /> </application>
To manually initialize SDK, call
ApxorSDK.initialize
method in yourApplicaiton
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
Add
staging-core
dependency inapp/build.gradle
fileAdd plugin dependencies to your application
build.gradle
filedependendies { // Add this to track uninstalls and send push notifications from Apxor dashboard // Note: We don't support firebase-messaging >= 22.0.0 yet implementation('com.apxor.androidx:staging-push:1.2.5@aar') { exclude group: 'com.google.firebase' } // Add these for Realtime Actions and Surveys implementation 'com.apxor.androidx:staging-qe:1.4.3@aar' implementation 'com.apxor.androidx:staging-rtm:1.7.0@aar' implementation 'com.apxor.androidx:staging-surveys:1.3.1@aar' // Add this to track application crashes implementation 'com.apxor.androidx:staging-crash-reporter:1.0.5@aar' // Helper plugin to create walkthroughs implementation 'com.apxor.androidx:staging-wysiwyg:1.1.9@aar' // Add this to log events without attributes at runtime implementation 'com.apxor.androidx:staging-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 }
Create
plugins.json
file in your assets folder (usual path issrc/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 ofapp/build.gradle
file, the SDK silently throws aClassNotFoundException
error log inlogcat
- If the dependency exists in
dependencies
section ofapp/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": "push", "class": "com.apxor.androidsdk.plugins.push.PushPlugin" }, { "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
staging-push
dependency inapp/build.gradle
file and corresponding JSON object inassets/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
- If an entry for plugin exists in this file and the corresponding dependency doesn't exist in the
Enable Apxor Push notifications [Optional]
If you are not using
FirebaseMessagingService
, you can skip this step. Otherwise, add the followingpublic 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 } } } }
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