Git Product home page Git Product logo

aepsdk-react-native's Introduction

aepsdk-react-native

license CircleCI

BETA ACKNOWLEDGEMENT

The React Native modules contained in this repository are currently in Beta. Use of this code is by invitation only and not otherwise supported by Adobe. Please contact your Adobe Customer Success Manager to learn more.

By using the Beta, you hereby acknowledge that the Beta is provided "as is" without warranty of any kind. Adobe shall have no obligation to maintain, correct, update, change, modify or otherwise support the Beta. You are advised to use caution and not to rely in any way on the correct functioning or performance of such Beta and/or accompanying materials.

About this project

This repository is a monorepo. It contains a collection of Adobe Experience Platform Mobile SDK React Native modules listed below. These modules can be found in the packages directory.

Package Name Latest Version
@adobe/react-native-aepcore (required) npm version npm downloads
@adobe/react-native-aepuserprofile npm version npm downloads
@adobe/react-native-aepedge npm version npm downloads
@adobe/react-native-aepedgeidentity npm version npm downloads
@adobe/react-native-aepedgeconsent npm version npm downloads
@adobe/react-native-aepmessaging npm version npm downloads
@adobe/react-native-aepassurance npm version npm downloads

@adobe/react-native-aep{extension} is a wrapper around the iOS and Android AEP SDK to allow for integration with React Native applications.

Note: @adobe/react-native-aepassurance <=2.0 is not compatible with @adobe/react-native-aepcore. Please use @adobe/react-native-aepassurance 3.x alpha versions or above

Requirements

  • React Native >= v0.60.0

Installation

You need to install the SDK with npm and configure the native Android/iOS project in your React Native project.

Note: If you are new to React Native, we suggest you follow the React Native Getting Started page before continuing.

Install npm package

Requires @adobe/react-native-aepcore to be installed.

Install the @adobe/react-native-aep{extension} package:

cd MyReactApp
npm install @adobe/react-native-aep{extension}

For iOS development, after installing the plugins from npm, download the pod dependencies by running the following command: cd ios && pod install && cd .. To update native dependencies to latest available versions, run the following command: cd ios && pod update && cd ..

Link

CLI autolink feature links the module while building the app.

Initializing

Initializing the SDK should be done in native code inside your AppDelegate (iOS) and MainApplication (Android). The following code snippets demonstrate how to import and register the Mobile Core, Identity, Lifecycle, Signal, and Profile extensions. For other extensions, the documentation on how to initialize the extension can be found in ./packages/{extension}/README.md

iOS
@import AEPCore;
@import AEPServices;
@import AEPSignal;
@import AEPLifecycle;
@import AEPEdge;
@import AEPEdgeIdentity;
@import AEPEdgeConsent;
//@import AEPMessaging;
//@import AEPUserProfile;
//@import AEPAssurance;
//@import AEPIdentity;
...
@implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [AEPMobileCore setLogLevel: AEPLogLevelDebug];
  [AEPMobileCore configureWithAppId:@"yourAppID"];
  [AEPMobileCore registerExtensions: @[
      AEPMobileLifecycle.class,
      AEPMobileSignal.class,
      AEPMobileEdge.class,
      AEPMobileEdgeIdentity.class,
      AEPMobileEdgeConsent.class,
      //AEPMobileIdentity.class,
      //AEPMobileUserProfile.class,
      //AEPMobileMessaging.class,
      //AEPMobileAssurance.class,
    ] completion:^{
    [AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];
  }
  ];

  return YES;
}

@end

Note : While running iOS application after AEPSDK installation. If you have build error that states: "ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'" This is because AEPSDK now requires the app uses swift interfaces. Add a dummy .swift file to your project to embed the swift standard libs. See the SampleApp presented in this repo for example.

Android:
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.InvalidInitException;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.Signal;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Edge;
import com.adobe.marketing.mobile.edge.consent.Consent;
//import com.adobe.marketing.mobile.Messaging;
//import com.adobe.marketing.mobile.UserProfile;
//import com.adobe.marketing.mobile.Assurance;
...
import android.app.Application;
...
public class MainApplication extends Application implements ReactApplication {
  ...
  @Override
  public void on Create(){
    super.onCreate();
    ...
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.DEBUG);
    try {
          Lifecycle.registerExtension();
          Signal.registerExtension();
          com.adobe.marketing.mobile.edge.identity.Identity.registerExtension();
          Edge.registerExtension();
          Consent.registerExtension();
          //Messaging.registerExtension();
          //Assurance.registerExtension();
          //UserProfile.registerExtension();
          //com.adobe.marketing.mobile.Identity.registerExtension();
      MobileCore.configureWithAppID("yourAppID");
      MobileCore.start(new AdobeCallback() {
        @Override
        public void call(Object o) {
          MobileCore.lifecycleStart(null);
        }
      });
    } catch (InvalidInitException e) {
      ...
    }
  }
}

Development

See development.md for development docs.

Contributing

See CONTRIBUTING

License

See LICENSE

aepsdk-react-native's People

Contributors

cacheung avatar yangyansong-adbe avatar pravinpk avatar shtomar-adb avatar ahmyr avatar sbenedicadb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.