/**
 Setup Pyze
 React Native App  */

Go back to React Native Getting Started Guide

Pyze React Native App SDK: Setup & Initialize

The instructions on this page assume you have installed the Pyze SDK into your React Native project. If not, Install the SDK and come back to this page. See Getting Started React Native Guide.

iOS

  1. Open the project in Xcode

  2. Add entry in embedded binaries

    Right click on the "Pyze.framework" framework and select "Show in Finder"

    Right click on Pyze.framework and Show In finder

    Drag and drop "Pyze.Framework" framework in the "Embedded Binaries" section under the "General" tab for the react native app target

    Drag and drop Pyze.framework into Embedded Binaries

  3. Update the framework search path

    Add the Pyze.framework parent folder to the framework search path

    Drag and drop Pyze.framework into Embedded Binaries

  4. Edit AppDelegate.m or ExtensionDelegate.m

    Open your AppDelegate.m in the project and import Pyze module i.e.

    #import <Pyze/Pyze.h>

    iOS - Add following lines in application:willFinishLaunchingWithOptions: method in the @implementation block of your App delegate code file. (usually AppDelegate.m). If you do not have application:willFinishLaunchingWithOptions: method in your class simply add it.

    For iOS and tvOS, add code in willFinishLaunchingWithOptions and NOT didFinishLaunchingWithOptions.
    Also see iOS App Lifecycle Deconstructed to understand your app's lifecycle

    // Objective C (iOS)
    - (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
        [Pyze initialize:@"<pyze app key for each app from growth.pyze.com>" 
             withLogThrottling: PyzelogLevelMinimal]; //see https://growth.pyze.com
        return YES;
    }
    

    Remember to replace <pyze app key for each app from growth.pyze.com> with the Pyze App key you got from growth.pyze.com

Android

  1. Add the Pyze Repository http://pyze.bintray.com/pyze-android in the Project build.gradle file

    In your project folder, go to Android - build.gradle and add the Pyze Repository URL to all projects in the Project build.gradle file, inside the repositories section:

    allprojects {
        repositories {
            ...
            maven {
                url  "http://pyze.bintray.com/pyze-android"
            }
            ...
        }
    }
  2. Add the PyzeAppKey obtained from growth.pyze.com in AndroidManifest.xml

    Add the PyzeAppKey in the Application Tag in the AndroidManifest.xml

    <meta-data android:name="PyzeAppKey" android:value="PYZE_APP_KEY"/>
  3. In the Main Activity for your project, make the following additions:

    Add the following import statement in the Main Activity present in MainApplication.java file under : android - app - src - main- java - com - PROJECTNAME - MainApplication.java

    import com.pyze.android.*;
  4. Add the following Pyze.initialize statement in the onCreate method of MainApplication.java

    public void onCreate(Bundle savedInstanceState) {
    //...
            Pyze.initialize(this);
        }
    

Build and Go!

Go back to React Native Developer Center to follow the next steps.


About Pyze

Pyze Growth Intelligence® is a transformative SaaS platform that enables mobile and web app businesses to automate engagement, retention and growth of their users. Signup at Pyze, install and initialize the Pyze SDK and watch your app grow.