npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-axa-mobile-sdk

v24.1.3

Published

CA App Experience Analytic native SDK's react native supplement for using custom metrics

Downloads

139

Readme

ReactNativeAxaMobileSdk

React Native Axa Mobile Sdk is a modern, well-supported, and cross-platform sdk for App Experience Analytics that provides deep insights into the performance, user experience, crash, and log analytics of apps.

Platforms Supported

  • iOS
  • Android

Getting started

DX App Experience Analytics

Check out our documentation for more information about the features that the App Experience Analytics SDK collects from your app.

Requirements

  • iOS
    1. Xcode 11 or higher
    2. iOS 9.0 or higher
  • Android

Installation

Follow these steps to integrate the react native axa mobile sdk in your project

Automatic installation

  1. Run the following command from your React Native project directory

    $ yarn add react-native-axa-mobile-sdk

    or

    $ npm install react-native-axa-mobile-sdk --save

  2. Run the following command for automatic linking

    $ react-native link react-native-axa-mobile-sdk

    1. Podfile update If you're already using Cocoapods, goto ios folder from your project and specify the pod below on a single line inside your target block in a Podfile
      pod 'react-native-axa-mobile-sdk', path: '../node_modules/react-native-axa-mobile-sdk'
      Then, run the following command using the command prompt from the ios folder of your project
      pod install
    2. Download the xxx_camdo.plist file and add it to your project target

    Follow these steps to integrate the Gradle App Bundle Plugin with your Android Project.

    1. Create /cadxapmsdk folder. This is the SDK root folder.
    2. Download the CAAppBundle_SDK.zip file and extract the contents to the SDK root.
    3. Download the .plist. Prefer it to be copied to the SDK root folder.
    4. Import and add the 'ca-maa-android-sdk-release.aar' file as a dependency.
    5. Update the build.gradle file(s).
      • Project Level
        • Add maven url 'https://packages.broadcom.com/apm-agents' under repositories and classpath 'com.ca.dxapm:sdk-gradle-plugin:' under dependencies of the project level build.gradle file.
      • App Level
        • Add apply plugin: com.ca.dxapm.sdk.gradle.plugin at the top of the app build.gradle file.
        • Add cadxapmsdk configuration block, specifying the absolute path to the downloaded plist.
        • Add dependency to SDK.
    6. Update AndroidManifest.xml file. Add the following permissions, if not already present.
      <uses-permission android:name='android.permission.INTERNET' />
      <uses-permission android:name='android.permission.ACCESS_NETWORK_STATE' />
      <uses-permission android:name='android.permission.ACCESS_WIFI_STATE' />
      <uses-permission android:name='android.permission.ACCESS_COARSE_LOCATION' />

    For more information, see https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/app-experience-analytics-saas/SaaS/configuring/collect-data-from-android-applications/Native-Android-Wrapping.html

Manual installation

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]

  2. Go to node_modulesreact-native-axa-mobile-sdk and add ReactNativeAxaMobileSdk.xcodeproj

  3. In XCode, in the project navigator, select your project. Add libReactNativeAxaMobileSdk.a to your project's Build PhasesLink Binary With Libraries

  4. Run your project (Cmd+R)<

  5. Podfile update

    If you're already using Cocoapods, goto ios folder from your project and specify the below pod on a single line inside your target block in a Podfile

    pod 'react-native-axa-mobile-sdk', path: '../node_modules/react-native-axa-mobile-sdk'

    Then, run the following command using the command prompt from the ios folder of your project

    pod install
  6. Drag & Drop the downloaded xxx_camdo.plist file into the Supporting files

  1. Open up android/app/src/main/java/[...]/MainActivity.java
    • Add import com.reactlibrary.ReactNativeAxaMobileSdkPackage; to the imports at the top of the file
    • Add new ReactNativeAxaMobileSdkPackage() to the list returned by the getPackages() method
  2. Append the following lines to android/settings.gradle:
    include ':react-native-axa-mobile-sdk'
    project(':react-native-axa-mobile-sdk').projectDir = new File(rootProject.projectDir,     '../node_modules/react-native-axa-mobile-sdk/android')
  3. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-test-sdk')

Initialising the SDK in your Source code

  1. Add the import header #import "CAMDOReporter.h" to your AppDelegate.m file
  2. Initialize the CAMobileAppAnalytics sdk in didFinishLaunchingWithOptions: method
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        [CAMDOReporter initializeSDKWithOptions:SDKLogLevelVerbose  completionHandler:nil];
        return YES;
    }
  3. Save and re-build your project
  1. Add a header file with the file name format as <app_name>-Bridging-header.h.

  2. Add the import header #import "CAMDOReporter.h" to your <app_name>-Bridging-header.h file.

  3. Add the <app_name>-Bridging-header.h file to Swift Compiler - Code Generation section in the Build Settings. <name of the project>/<app_name>-Bridging-header.h

  4. Initialize the CAMobileAppAnalytics sdk in didFinishLaunchingWithOptions method

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        //Initialize CA App Experience Analytics SDK
        CAMDOReporter.initializeSDK(options: SDKOptions.SDKLogLevelVerbose) { (completed, error) in
    
        }
        return true
    }
  5. Save and re-build your project

Updation

Follow these steps to updgrade the react native axa mobile sdk in your project

  1. Run the following command from your React Native project directory

    $ yarn upgrade react-native-axa-mobile-sdk

    or

    $ npm update react-native-axa-mobile-sdk --save

  2. Run $ pod update command from the ios folder.

Usage

import { NativeModules } from 'react-native';

const AXASDK = NativeModules.ReactNativeAxaMobileSdk;

APIs

Individual APIs interact with the SDK to perform specific tasks, reading, or setting information. All APIs are asynchronous and returning information is achieved using a callback function or block. The specifics can be found in the React Native documentation for Android or iOS callbacks.

A callback returns one or more values.

Once you have assigned a variable or constant to the ReactNativeAxaMobileSdk module as shown in "Usage", calling individual APIs is as simple as:

AXASDK.individualAPI();
AXASDK.individualAPI(argument1, argument2, ...);
AXASDK.individualAPI(argument1, ..., callback);
AXASDK.individualAPI(argument1, argument2, ..., callback);

Follow the examples in the API descriptions below for how to use the callbacks. The examples presented use a block with parameters instead of a function. Either format will work in practice.

disableSDK()

When disabled, the SDK no longer does any tracking of the application, or user interaction.

AXASDK.disableSDK();

enableSDK()

The SDK is enabled by default. You need to call this API only if you called disableSDK earlier.

AXASDK.enableSDK();

isSDKEnabled( callback )

Parameters:

  • callback is a function which expects a boolean value
AXASDK.isSDKEnabled((isEnabled) => {
    if (isEnabled) {
        // enabled action
    } else {
        // non-enabled action
    }
    console.log(`SDK is enabled: ${isEnabled}`);
})

getDeviceId( callback )

Parameters:

  • callback is a function which expects a string value.
AXASDK.getDeviceId((deviceId) => {
    if (deviceId) {
        console.log(`received device id: ${deviceId}`);
    }
})

getCustomerId( callback )

Parameters:

  • callback is a function which expects a string value

If the customer ID is not set, this API returns a null value.

AXASDK.getCustomerId((customerId) => {
    if (customerId) {
        console.log(`received customer id: ${customerId}`);
    }
})

setCustomerId( customerId, callback )

Parameters:

  • customerId is a string containing the customer ID
  • callback is a function which expects an (SDKError value)

If an empty string is passed, the customer ID is reset. An SDKError value is returned.

var customerId = "New Customer"

AXASDK.setCustomerId(customerId, (SDKError) => {
    switch (SDKError) {
      case ErrorNone:
        console.log(`CustomerId set successfully.`);
        break;
      case ErrorNoTransactionName:
      case ErrorTransactionInProgress:
      case ErrorFailedToTakeScreenshot:
      case ErrorInvalidValuesPassed:
      default:
        console.log(`Error setting customer Id: ${SDKError}`);
    }
})

SDKError Values

  • ErrorNone
  • ErrorNoTransactionName
  • ErrorTransactionInProgress
  • ErrorFailedToTakeScreenshot
  • ErrorInvalidValuesPassed

To retrieve these constants include the following code prior to use:

const AXASDK = NativeModules.ReactNativeAxaMobileSdk;

// Set constants for SDKError
const { ErrorNone }                        = AXASDK.getConstants();
const { ErrorNoTransactionName }           = AXASDK.getConstants();
const { ErrorTransactionInProgress }       = AXASDK.getConstants();
const { ErrorFailedToTakeScreenshot }      = AXASDK.getConstants();
const { ErrorInvalidValuesPassed }         = AXASDK.getConstants();

setSessionAttribute( name, value, callback )

Parameters:

  • name is a string containing the name of the attribute
  • value is a string containing the value for the attribute
  • callback is a function which expects an (SDKError value)

If an empty string is passed, the customer id is reset. An SDKError value is returned.

var attributeName = "ClientDemo";
var attributeValue = "NewFeatures";

AXASDK.setSessionAttribute(attributeName, attributeValue, (SDKError) => {
    switch (SDKError) {
      case ErrorNone:
        console.log(`Session attribute ${attributeName}=${attributeValue} set successfully.`);
        break;
      case ErrorNoTransactionName:
      case ErrorTransactionInProgress:
      case ErrorFailedToTakeScreenshot:
      case ErrorInvalidValuesPassed:
      default:
        console.log(`Error setting session attribute: SDKError:${SDKError}`);
    }
})

SDKError Values

  • ErrorNone
  • ErrorNoTransactionName
  • ErrorTransactionInProgress
  • ErrorFailedToTakeScreenshot
  • ErrorInvalidValuesPassed

To retrieve these constants include the following code prior to use:

const AXASDK = NativeModules.ReactNativeAxaMobileSdk;

// Set constants for SDKError
const { ErrorNone }                        = AXASDK.getConstants();
const { ErrorNoTransactionName }           = AXASDK.getConstants();
const { ErrorTransactionInProgress }       = AXASDK.getConstants();
const { ErrorFailedToTakeScreenshot }      = AXASDK.getConstants();
const { ErrorInvalidValuesPassed }         = AXASDK.getConstants();

enterPrivateZone()

The following data is not collected when the app enters a private zone:

  • Screenshots
  • Location information including GPS and IP addresses
  • Values in any text entry fields

The SDK is enabled by default. You need to call this API only if you called disableSDK earlier.

AXASDK.enterPrivateZone();

exitPrivateZone()

AXASDK.exitPrivateZone();

isInPrivateZone( callback )

Parameters:

  • callback is a function which expects a boolean value
AXASDK.isInPrivateZone((inPrivateZone) => {
    if (inPrivateZone) {
        // private zone action
    } else {
        // non-private zone action
    }
    console.log(`SDK is in private zone: ${inPrivateZone}`);
})

getAPMHeader( callback )

Parameters:

  • callback is a function which expects a dictionary or map of key, value pairs
AXASDK.getAPMHeader((headers) => {
    if (headers) {
        console.log(`received apm headers: ${headers}`);
        // TOTO: show how to access values in this dictionary
        // using values, keys, or entries
        //
        for (const [key, value] of Object.entries(headers)) {
            console.log(`${key}: ${value}`);
        }

    }
})

addToAPMHeader( data )

Parameters:

  • data is a non-empty string in the form of "key=value".

data will be appended to the APM header separated by a semicolon (;).

var newAPMData = "PrivateKey=PrivateInfo";

AXASDK.addToAPMHeader(newAPMData);

setSSLPinningMode( pinningMode, pinnedValues )

Parameters:

  • pinningMode is one of the CAMDOSSLPinning modes described below
  • pinnedValues is an array as required by the pinning mode
var pinningMode = CAMDOSSLPinningModeFingerPrintSHA1Signature;
var pinnedValues = [--array of SHA1 fingerprint values--];

AXASDK.setSSLPinningMode(pinningMode, pinnedValues);       

####Supported pinning modes:

- CAMDOSSLPinningModePublicKey OR CAMDOSSLPinningModeCertificate
        - array of certificate data (NSData from SeccertificateRef)
        - or, certificate files(.cer) to be present in the resource bundle
- CAMDOSSLPinningModeFingerPrintSHA1Signature
        - array of SHA1 fingerprint values
- CAMDOSSLPinningModePublicKeyHash
        - array of PublicKeyHashValues

stopCurrentSession()

No data will be logged until the startSession API is called.

AXASDK.stopCurrentSession();

startNewSession()

If a session is already in progress, it will be stopped and new session is started.

AXASDK.startNewSession();

stopCurrentAndStartNewSession()

Equivalent to calling stopCurrentSession() followed by startNewSession()

AXASDK.stopCurrentAndStartNewSession();

startApplicationTransaction( transactionName, serviceName, callback )

Parameters:

  • transactionName is a string to indicate the transaction being processed
  • serviceName is a string to indicate the service or application being applied
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var transactionName = "subscription";
var serviceName = "MyApp"";
// serviceName may also be null

AXASDK.startApplicationTransaction(transactionName, serviceName, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***transaction ${transactionName} started (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`***transaction error: ${errorString}`)
        }
    }
})

stopApplicationTransaction( transactionName, failureString, callback )

Parameters:

  • transactionName is a string to indicate the transaction being processed
  • failureString is a string to indicate the failure name, message or type
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var transactionName = "subscription";
var failureString = "Mismatched Arguments";
// failureString may also be null

AXASDK.stopApplicationTransaction(transactionName, failureString, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***transaction ${transactionName} stopped (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error stopping transaction: ${errorString}`)
        }
    }
})

setCustomerFeedback( feedback )

Parameters:

  • feedback is a string containing any customer feedback for the crash.

The App has to register for CAMAA_CRASH_OCCURRED notification and collect the feedback from the user while handling the notification. See the Getting Started documentation for more details.

var feedback = "something interesting happened";
AXASDK.setCustomerFeedback(feedback);

setCustomerLocation( postalCode, countryCode )

Parameters:

  • postalCode is a string with the postal code, e.g. zip code in the US.
  • countryCode is a string with the two letter international code for the country
var postalCode = "95200";
var countryCode = "US";
AXASDK.setCustomerLocation(postalCode, countryCode);

sendScreenShot( screenName, imageQuality, callback )

Parameters:

  • screenName is a string to indicate the desired name for the screen
  • imageQuality is number indicating the quality of the image between 0.0 and 1.0
  • callback is a function expecting a boolean completed, and a string errorString

Using raw numbers for imageQuality may produce unexpected results. Use the CAMAA_SCREENSHOT_QUALITY values shown below for best results.

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var screenName = "My custom Screen";
var imageQuality = CAMAA_SCREENSHOT_QUALITY_MEDIUM;

AXASDK.sendScreenShot(screenName, imageQuality, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***screen shot sent (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error sending screen shot: ${errorString}`)
        }
    }
})

imageQuality values

The following values for imageQuality are defined:

  • CAMAA_SCREENSHOT_QUALITY_HIGH
  • CAMAA_SCREENSHOT_QUALITY_MEDIUM
  • CAMAA_SCREENSHOT_QUALITY_LOW
  • CAMAA_SCREENSHOT_QUALITY_DEFAULT

To retrieve these constants include the following code prior to use:

const AXASDK = NativeModules.ReactNativeAxaMobileSdk;

// Set constants for CAMAA_SCREENSHOT_QUALITY
const { CAMAA_SCREENSHOT_QUALITY_HIGH }    = AXASDK.getConstants();
const { CAMAA_SCREENSHOT_QUALITY_MEDIUM }  = AXASDK.getConstants();
const { CAMAA_SCREENSHOT_QUALITY_LOW }     = AXASDK.getConstants();
const { CAMAA_SCREENSHOT_QUALITY_DEFAULT } = AXASDK.getConstants();

viewLoaded( viewName, loadTime, callback )

Parameters:

  • viewName is the name of the view that was loaded
  • loadTime is the time it took to load the view
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var viewName = "my custom view";
var loadTime = 237;

AXASDK.viewLoaded(viewName, loadTime, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***view load recorded (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error recording view load: ${errorString}`)
        }
    }
})

ignoreView( viewName )

Parameters:

  • viewName is Name of the view to be ignored.

Screenshots and transitions of the views that are in ignore list are not captured. If more than one view is to be ignored, the API call ignoreViews() may be called with a list.

var viewName = "view1";

AXASDK.ignoreView(viewName);

ignoreViews( viewNames )

Parameters:

  • viewNames is a list (an Array) of names of the views to be ignored.

Screenshots and transitions of the views that are in ignore list are not captured. If only a signle view name is to be ignored, the API call ignoreView() may be called with the view name.

var viewNames = ["view1", "view2", ..., "viewN"];

AXASDK.ignoreViews(viewNames);

isScreenshotPolicyEnabled( callback )

Parameters:

  • callback is a function which expects a boolean value

Returns YES if screenshots are enabled by policy. Otherwise returns NO.

AXASDK.isScreenshotPolicyEnabled((isEnabled) => {
    if (isEnabled) {
         // enabled action
    } else {
        // non-enabled action
    }
    console.log(`Screenshots enabled by policy: ${isEnabled}`);
})

logNetworkEvent( url, status, responseTime, inBytes, outBytes, callback )

Parameters:

  • url is a string reprentation of the network URL to be logged
  • status is an integer value indicating the status, e.g. 200, 404, etc.
  • responseTime is an integer value representing the response time
  • inBytes is an integer value representing the number of bytes input
  • outBytes is an integer value representing the number of bytes output
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var url = "https://myserver/specific_content/";"
var status = "OK";"
var responseTime = 234;
var inBytes = 864200;
var outBytes = 6236;

AXASDK.logNetworkEvent( url, status, responseTime, inBytes, outBytes, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***network event logged (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error logging network event: ${errorString}`)
        }
    }
})

logTextMetric( textMetricName, textMetricValue, attributes, callback )

Parameters:

  • textMetricName is a string to indicate a text metric name
  • textMetricValue is a string to indicate a text metric value
  • attributes is a Map or Dictionary used to send any extra parameters
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var textMetricName = "ImageName";
var textMetricValue = "Pretty Picture";
var attributes = null;

AXASDK.logTextMetric( textMetricName, textMetricValue, attributes, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***text metric logged (${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error logging text metric: ${errorString}`)
        }
    }
})

logNumericMetric( numericMetricName, numericMetricValue, attributes, callback )

Parameters:

  • numericMetricName is a string name for a numeric metric
  • numericMetricValue is a numeric value, e.g. 3.14159, 2048.95, or 42, etc.
  • attributes is a Map or Dictionary used to send any extra parameters
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

var numericMetricName = "ImageWidth";
var numericMetricValue = 1080;
// if numericMetricValue is a string, remember to use
//    parseFloat(numericMetricValue) or Number(numericMetricValue)
var attributes = null;

AXASDK.logNumericMetric( numericMetricName, numericMetricValue, attributes, (completed, errorString) => {
    if (completed) {
        // everything is fine
        console.log(`***numeric metric logged(${completed}) ${errorString}`);
    } else {
        if (errorString) {
            // process error message
            console.log(`error logging numeric metric: ${errorString}`)
        }
    }
})

uploadEvents( callback )

An upload event sends all information collected since any previous upload event to the APM servers.

Parameters:

  • callback is a function which expects a response object and an ErrorString.

response is a key,value paired map or dictionary object which contains:

  • the Key 'CAMDOResponseKey' holds any URLResponse information
  • the key 'CAMDOTotalUploadedEvents' holds the total number of events uploaded

errorString is empty if the API call is completed, otherwise is a localized error description

AXASDK.uploadEvents((response, errorString) => {
    if (errorString) {
        // process error message
        console.log(`error: ${errorString}`)
    } else {
        var events=response.CAMDOTotalUploadedEvents;
        var key=response.CAMDOResponseKey;
        console.log(`***uploaded ${events} events (key:${key})`);
    }
})

iOS-only APIs

The iOS version of the SDK implements a few APIs which are not available in the Android version of the SDK.

The best way to handle these APIs is to put them in conditionals for the platform the App is running on rather than creating separate module.ios.js or module.android.js files. See the example code below.

setNSURLSessionDelegate( delegate )

Use it when using SDKUseNetworkProtocolSwizzling option during SDK initialization.

Parameters:

  • delegate is an iOS native object or module which responds to NSURLSessionDelegate protocols.
import Platform from react;

if (Platform.OS == "ios") {
    AXASDK.setNSURLSessionDelegate(delegate);
}

setLocation( latitude, longitude )

Parameters:

  • latitude is a double with the geographic latitude from -90,0 to 90.0 degrees.
  • longitude is a double with the geographic longitude from -180.0 to 180.0 degrees.
import Platform from react;

if (Platform.OS == "ios") {
    // use iOS specific location setting call
    var latitude = 34.678;
    var longitude = -122.456;
    AXASDK.setLocation(latitude, longitude);
} else {
    // use Android specific location setting call
}

enableScreenShots( captureScreen )

Parameters:

  • captureScreen is a boolean value to enable/disable automatic screen captures.

Normally the policy determines whether automatic screen captures are performed. Use this API to override the policy, or the current setting of this flag.

import Platform from react;

if (Platform.OS == "ios") {
    AXASDK.enableScreenShots(true);
      // or
    AXASDK.enableScreenShots(false);
}

viewLoadedWithoutScreenCapture( viewName, loadTime, callback )

During a loadView call, on iOS only, screen captures are controlled by policy, or the setting of the enableScreenShots API call. The iOS SDK allows the calling API to disable automatic screen captures if they are currently enabled. This API call prevents any screen capture during the loadView call by overriding policy for this invocation.

Parameters:

  • viewName is the name of the view that was loaded
  • loadTime is the time it took to load the view
  • callback is a function expecting a boolean completed, and a string errorString

If successful, completed = YES and errorString = an empty string. In case of failure, completed = NO and errorString = an error message. Error message will contain the error domain, a code, and a localized description.

import Platform from react;

if (Platform.OS == "ios") {
    var viewName = "my custom view";"
    var loadTime = 237;

    AXASDK.viewLoadedWithoutScreenCapture(viewName, loadTime, (completed, errorString) => {
        if (completed) {
            // everything is fine
            console.log(`***view load recorded (${completed}) ${errorString}`);
        } else {
            if (errorString) {
                // process error message
                console.log(`error recording  view load: ${errorString}`)
            }
        }
    })
}

Android-only APIs

The Android version of the SDK implements a few APIs which are not available in the iOS version of the SDK.

Build this Native Module (dev)

  • npm install
  • npm pack (to test locally)
  • Test the packaged archive with sample appliaction, by adding something like this in packages.json file :
 "react-native-axa-mobile-sdk": "file:../../GitHome/AXA/ReactNativeAxaMobileSdk/react-native-axa-mobile-sdk-2022.8.1.tgz",
  • npm publish (publish to NPM)