@adobe/react-native-aepassurance

Adobe Experience Platform support for React Native apps.

Usage no npm install needed!

<script type="module">
  import adobeReactNativeAepassurance from 'https://cdn.skypack.dev/@adobe/react-native-aepassurance';
</script>

README

React Native Adobe Experience Platform Assurance Extension

npm version npm downloads

@adobe/react-native-aepassurance is a wrapper around the iOS and Android Adobe Experience Platform Assurance to allow for integration with React Native applications. Functionality to start Assurance session is provided through JavaScript documented below.

Prerequisites

The Adobe Experience Platform Assurance extension has the following peer dependency, which must be installed prior to installing the identity extension:

Installation

See Requirements and Installation instructions on the main page

Install the @adobe/react-native-aepassurance package:

cd MyReactApp
npm install @adobe/react-native-aepassurance

Usage

Assurance

Initializing:

Initializing the SDK should be done in native code, documentation on how to initialize the SDK can be found here.

Example:

iOS

@import AEPAssurance;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [AEPMobileCore configureWithAppId:@"your-app-ID"];
  [AEPMobileCore registerExtensions: @[AEPMobileLifecycle.class, AEPMobileAssurance.class] completion:^{
          [AEPMobileCore lifecycleStart:nil];
  }];
  return YES;
}

To connect to a griffon session by scanning the QR code. Follow Apple developer documentation to set custom URL scheme for your application. Finally, implement the openURL delegate method and pass the deeplink URL to startSessionWithURL API.

-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  [AEPMobileAssurance startSessionWithUrl:url];
  return true;
}

Android

import com.adobe.marketing.mobile.Assurance;

public class MainApplication extends Application implements ReactApplication {

  @Override
  public void onCreate() {
    super.onCreate();

    MobileCore.setApplication(this);
    try {
        Lifecycle.registerExtension();
        Assurance.registerExtension();
        MobileCore.configureWithAppID("your-app-ID");
        MobileCore.start(null);
      } catch (InvalidInitException e) {
        // handle exception
      }
    }
}    

To connect to a griffon session by scanning the QR code. Follow the Android documentation on information about how to setup a deeplink.

Start Assurance session:
import {Assurance} from '@adobe/react-native-aepassurance';
Assurance.startSession("{your-assurance-session-url}");