1.0.5 • Published 5 years ago

apxor-react-native-sdk v1.0.5

Weekly downloads
18
License
-
Repository
-
Last release
5 years ago

apxor-react-native-sdk

Getting started

$ npm install apxor-react-native-sdk --save

Mostly automatic installation

$ react-native link apxor-react-native-sdk

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.apxor.reactnativesdk.ApxorReactNativeSdkPackage; to the imports at the top of the file
  • Add new ApxorReactNativeSdkPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':apxor-react-native-sdk'
    project(':apxor-react-native-sdk').projectDir = new File(rootProject.projectDir, 	'../node_modules/apxor-react-native-sdk/android')

Additional steps todo

  1. Insert the following lines inside repositories block in android/build.gradle

      maven { url "http://repo.apxor.com/artifactory/list/libs-release-android/" }
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:

      compile project(':apxor-react-native-sdk')
      implementation 'com.apxor.android:apxor-android-sdk-core:2.3.7@aar'
  3. Insert the following lines in the onCreate method in android/app/src/main/java/(package)/MainApplication.java:

    ApxorSDK.initialize("<APP_ID>", MainApplication.this);

    Note:

    • The second argument, MainApplication.this, makes sures to provide ApplicationContext instead of ReactApplicationContext for ApxorSDK to work properly.
    • If you change the application class name (default: MainApplication), make sure to use your_class_name.this instead.

Push Notification Module (Optional)

  1. Insert the following lines inside the dependencies block in android/app/build.gradle:

      implementation 'com.apxor.android:apxor-android-sdk-push:1.1.5@aar'
      implementation 'com.google.firebase:firebase-messaging:11.4.0'
  2. Insert the following piece of code in the onMessageReceived(RemoteMessage) function

      if (ApxorPushAPI.isApxorNotification(message)) {
          ApxorPushAPI.handleNotification(message, getApplicationContext());
      }

Usage

import ApxorReactNativeSdk from 'apxor-react-native-sdk';

UserId:

ApxorReactNativeSdk.setUserIdentifier("user_id");
Example
ApxorReactNativeSdk.setUserIdentifier("<some_user_id>");

Events:

ApxorReactNativeSdk.logAppEvent(event_name, properties);
Example
ApxorReactNativeSdk.logAppEvent("ADD_TO_CART", {
    "userId": "user@example.com",
    "value": "1299",
    "item": "Sony Head Phone 1201" 
});

User Properties:

ApxorReactNativeSdk.setUserCustomInfo(properties);
Example
ApxorReactNativeSdk.setUserCustomInfo({
    "property1": "value",
    "property2": "value2"
});

Track Navigation:

ApxorReactNativeSdk.logNavigationEvent(screen_name);
Example
ApxorReactNativeSdk.logNavigationEvent("LoginScreen");
1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago