React Native SDK

SDK Installation


Package Installation

npm

Install airbridge-react-native-sdk using npm.

npm install --save airbridge-react-native-sdk

React-native link or cocoapods

Execute the following command.

cd ios
pod install
react-native link airbridge-react-native-sdk

Import

Add the following code to the index.js file of the project to import the Airbridge SDK.

import Airbridge from 'airbridge-react-native-sdk';

Project Setup (Android)

MainApplication.java

Add the following code to the onCreate function within the android/app/src/main/java/.../MainApplication.java file.

import co.ab180.airbridge.reactnative.AirbridgeRN;

//...

@Override
public void onCreate() {
    super.onCreate();
    AirbridgeRN.init(this, "APP_NAME", "APP_TOKEN");
    ...
}

APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name".
APP_TOKEN can be found at the "Airbridge dashboard → Settings → Tokens → App SDK Token".


Project Setup (iOS)

AppDelegate.m

Add the following code to the import section of the ios/[Project Name]/AppDelegate.m file.

#import <AirbridgeRN/AirbridgeRN.h>
// Use a bridge header

#import <AirbridgeRN/AirbridgeRN.h>

🚧

Use a bridge header if you are using Swift.

Add the following code to the application:idFinishLaunchingWithOptions: function within the ios/[Project Name]/AppDelegate.m file.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [AirbridgeRN getInstance:@"APP_TOKEN" appName:@"APP_NAME" withLaunchOptions:launchOptions];
    ...
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AirbridgeRN.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)
}

APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name".
APP_TOKEN can be found at the "Airbridge dashboard → Settings → Tokens → App SDK Token".


React Native Settings

airbridge.json

  1. Create an airbridge.json file in the project folder.
  2. Configure settings in JSON format.

When using React Native 0.59.X or lower with iOS, the below setup is needed for iOS.

  1. Go to "Xcode → Project file → Build Phases → Copy Bundle Resources".
  2. Click "+" and add airbridge.json file.

Example

{
    "sessionTimeoutSeconds": 300,
    "autoStartTrackingEnabled": true,
    "userInfoHashEnabled": true,
    "trackAirbridgeLinkOnly": false,
    "facebookDeferredAppLinkEnabled": false,
    "locationCollectionEnabled": false,
    "trackingAuthorizeTimeoutSeconds": 0
}

Name

Type

Default

Description

sessionTimeoutSeconds

Number

300

An app open event will not be sent when the app is reopened within the designated period.

autoStartTrackingEnabled

Boolean

true

When set to false, no events will be sent until Airbridge.state.startTracking() is called.

userInfoHashEnabled

Boolean

true

When set to false, user email and user phone information are sent without being hashed.

trackAirbridgeLinkOnly

Boolean

false

When set to true, deep link events are sent only when app is opened with an Airbridge deep link.

facebookDeferredAppLinkEnabled

Boolean

false

When set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected.

locationCollectionEnabled

Boolean

false

When set to true, location information is collected. (Android Only)

Two permissions must be allowed in AndroidManifest.xml
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION

trackingAuthorizeTimeoutSeconds

Number

0

When timeout is set, Install event is delayed until Request tracking authorization alert is clicked. (iOS only)


Testing the SDK

Check if install events are sent when the application is installed and opened.

Check in the Airbridge Dashboard

Events from the Airbridge SDK are shown at the "Airbridge Dashboard → Raw Data → App Real-time Logs".

  1. Go to the "Airbridge Dashboard → Raw Data → App Real-time Logs".
  2. Search for the device's ADID (IDFA, IDFV, GAID).

Logs may be delayed for up to 5 minutes.



Deep Link Setup


Dashboard Setup (Android)

20042004

The following information must be registered at the "Airbridge dashboard → Tracking Link → Deep Link"

  • URI Scheme
  • sha256_cert_fingerprints

Android URI Scheme Setup

Enter the URI scheme that will be used, including ://, in the "Android URI Scheme" area as shown in the picture above. (e.g. example://, yoururischeme://)

🚧

Airbridge supports lowercase, numbers, and some special characters (-, +, .) for URI Schemes.

Register Fingerprint

Follow the below steps to obtain the sha256_cert_fingerprint.

  1. Prepare the keystore file that you used to register your app with Google Play Store.
  2. Execute the following command.
keytool -list -v -keystore my-release-key.keystore
  1. Copy the SHA256 value under the Certificate Fingerprints section and paste it under "Android sha256_cert_fingerprints" as shown in the picture above.
Certificate fingerprints:
    MD5:  4C:65:04:52:F0:3F:F8:65:08:D3:71:86:FC:EF:C3:49
    SHA1: C8:BF:B7:B8:94:EA:5D:9D:38:59:FE:99:63:ED:47:B2:D9:5A:4E:CC
    SHA256: B5:EF:4D:F9:DC:95:E6:9B:F3:9A:5E:E9:D6:E0:D8:F6:7B:AB:79:C8:78:67:34:D9:A7:01:AB:6A:86:01:0E:99

Dashboard Setup (iOS)

20042004

The following information must be registered at the "Airbridge Dashboard → Tracking Link → Deep Link".

  • iOS URI Scheme
  • iOS App ID

iOS URI Scheme Setup

Enter the URI scheme that will be used, including ://, in the "iOS URI Scheme" area as shown in the picture above. (e.g. example://, yoururischeme://)

🚧

Airbridge supports lowercase, numbers, and some special characters (-, +, .) for URI Schemes.

iOS App ID Setup

  1. Go to "Identifiers" at https://developer.apple.com/account/resources.
  2. Click identifier of the application that you want to track.
  3. Copy the identifier information to "iOS App ID" at the Airbridge dashboard in the following format: "App ID Prefix" + "." + "Bundle ID" (e.g. 9JA89QQLNQ.com.apple.wwdc)
20482048

Project Setup

setDeeplinkListener

Register a function that will be called whenever a deep link or a deferred deep link opens the application.

Airbridge.deeplink.setDeeplinkListener((deeplink) => {
    // code that wil run when a deep link or deferred deep link occurs
    // deeplink = YOUR_SCHEME://...

    console.log(deeplink);
});

All deep links that open apps are sent to DeeplinkCallback
Of those deep links, "Airbridge deep links" will be sent using the URI Scheme (YOUR_SCHEME://...) that was set in the Airbridge dashboard.


Project Setup (Android)

AndroidManifest.xml

In the MainActivity section of the android/app/src/main/AndroidManifest.xml file, add android:LaunchMode and intent-filter parameters as below.

<activity android:name=".MainActivity"
    android:launchMode="singleTask"
    ...>
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="http" android:host="APP_NAME.deeplink.page" />
        <data android:scheme="https" android:host="APP_NAME.deeplink.page" />
    </intent-filter>
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="http" android:host="APP_NAME.airbridge.io" />
        <data android:scheme="https" android:host="APP_NAME.airbridge.io" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="YOUR_SCHEME" />
    </intent-filter>
    ...
<activity/>

Enter your app name at APP_NAME.
Enter your scheme value set in the Airbridge dashboard at YOUR_SCHEME. (e.g. abc://)

MainActivity.java

Insert the following code in the android/app/src/main/java/.../MainActivity.java file.

@Override
protected void onResume() {
    super.onResume();

    AirbridgeRN.processDeeplinkData(getIntent());
}

@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
}

Project Setup (iOS)

Scheme

  1. Go to "Xcode → Project file → Info → URL Types".
  2. From the Airbridge dashboard, copy "iOS URI Scheme" to Xcode's "URL Schemes". (Do not include ://)
768768

Universal Link

  1. Go to "Xcode → Project file → Signing & Capabilities".
  2. Click "+ Capability" and add "Associated Domains".
  3. Add applinks:YOUR_APP_NAME.airbridge.io to "Associated Domains".
  4. Add applinks:YOUR_APP_NAME.deeplink.page to "Associated Domains".

YOUR_APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name".
Please refer to Troubleshooting → Webcredentials if you want to use the autofill feature.

Send Deep Link Information to SDK

  1. Open ios/[Project name]/AppDelegate.
  2. Send deeplink information to the SDK when the application is opened through schemes by calling the handleURLSchemeDeeplink method at the beginning of the following function.
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
{
    NSLog(@"openURL : %@", url);

    [AirbridgeRN.deeplink handleURLSchemeDeeplink:url];

    return YES;
}
func application(_ app: UIApplication,
                 open url: URL,
                 options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
{
    NSLog(@"openURL : %@", url)

    AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url)
    
    return true
}
  1. When targeting iOS 8.x or earlier, also call the handleURLSchemeDeeplink method at the beginning of the following function.
- (BOOL)application:(UIApplication*)application
            openURL:(NSURL*)url
  sourceApplication:(NSString*)sourceApplication 
         annotation:(id)annotation
{
    NSLog(@"openURL : %@", url);

    [AirbridgeRN.deeplink handleURLSchemeDeeplink:url];

    return YES;
}
func application(_ application: UIApplication,
                 open url: URL,
                 sourceApplication: String?,
                 annotation: Any) -> Bool
{
    NSLog(@"openURL : %@", url)

    AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url);
    
    return true;
}
  1. Send deep link information to the SDK when the application is opened through an universal link by calling the handleUniversalLink method at the beginning of the following function.
-  (BOOL)application:(UIApplication*)application
continueUserActivity:(NSUserActivity*)userActivity
  restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
{
    NSLog(@"continueUserActivity : %@", userActivity.webpageURL);

    [AirbridgeRN.deeplink handleUniversalLink:userActivity.webpageURL];

    return YES;
}
func application(_ application: UIApplication,
                 continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
{
    if let webpageURL = userActivity.webpageURL {
        NSLog("continueUserActivity : %@", webpageURL)
      
        AirbridgeRN.deeplink()?.handleUniversalLink(webpageURL)
    }
    
    return true
}

Custom Domain Setup (Optional)

Please refer to the below guides to setup your custom domain with Airbridge.

iOS: Guide
Android: Guide


Test Deep Link

Click on your URI scheme to test if your deep link has been properly set up in the Airbridge SDK.

  • YOUR_APP_URI_SCHEME://

The results will show on the "Airbridge dashboard → Row Data → App Real-time Log" tab if everything is working.



User Setup


User Identifier Setup

Once a user identifier information is sent to the SDK, all events thereafter will contain the corresponding user identifier information.

Name

Description

Limitations

ID

User ID

email

User Email

Hashed by default
(SHA256, can be disabled)

phone

User phone number

Hashed by default
(SHA256, can be disabled)

attributes

User attributes

  • Maximum 100 attributes
  • "key" type is string, maximum 128 characters
  • "key" must satisfy ^[a-z_][a-z0-9_]*$ regex
  • "value" type is primitive or string
  • Maximum 1024 characters when "value" is string

alias

Another User ID

  • Maximum 10 aliases
  • "key" type is String, maximum 128 characters
  • "key" must satisfy ^[a-z_][a-z0-9_]*$ regex
  • `"value" type is String, maximum 1024 characters

Example

Airbridge.state.setUser({
    ID: 'personID1',
    email: '[email protected]',
});
Airbridge.state.setUser({
    email: '[email protected]',
    phone: '1(123)123-1234',
});
Airbridge.state.updateUser({
    ID: 'personID3',
});

The above code operates in the following order.

  1. User = { ID: 'personID1', email: '[email protected]' }
  2. User = { ID: 'personID1', email: '[email protected]', phone: '1(123)123-1234' }
  3. User = { ID: 'personID3', email: '[email protected]', phone: '1(123)123-1234)' }

User Attribute Setup

Additional user attributes can be set for various purposes such as MTA (Multi-Touch Attribution) analysis, internal data analysis and 3rd party solution integrations.

Airbridge.state.updateUser({
    attributes: {
      age_group: "30",
      gender: "Female"
    }
});

Testing

Make sure that your user information settings are being properly sent through the SDK.

  1. Configure user identifier information.
  2. Send an event using the SDK.
  3. Click the event at "Airbridge dashboard → Raw Data → App Real-time Logs"
  4. Check if the user information is correctly sent under the user block.



Event Setup


When important user actions occur, in-app events can be sent to measure the performance of each channel.

All event parameters are optional. However, more information about the event will help provide a more accurate analysis.


Custom Event

Send custom events with the SDK.

Airbridge.event.custom('Custom', {
    action: 'Action custom',
    label: 'Label custom',
    value: 9999,
    attributes: {
        custom: 'value custom',
    },
    semantics: {
        transactionID: 'test transactionID',
    },
});

Standard Events

Send standard user events with the SDK.

action, label, value, attributes can also be used when sending standard events.

Sign Up

User identifiers are set by values inserted below when signing up.

Airbridge.event.signUp({
    ID: 'personID1',
    email: '[email protected]',
    phone: '1(123)123-1234',
});

Sign In

User identifiers are set by values inserted below when signing in.

Airbridge.event.signIn({
    ID: 'personID1',
    email: '[email protected]',
    phone: '1(123)123-1234',
});

Sign Out

User identifiers are reset.

Airbridge.event.signOut();

View Home Screen

Airbridge.event.viewHome();

View Product Detail

Airbridge.event.viewProductDetail({
    products: [
        {
            ID: 'coke_zero',
            name: 'Coke Zero',
            price: 1.99,
            currency: 'USD',
            position: 1,
            quantity: 1,
        },
    ],
});

View Product List

Airbridge.event.viewProductList({
    listID: 'food',
    products: [
        {
            ID: 'coke_zero',
            name: 'Coke Zero',
            price: 1.99,
            currency: 'USD',
            position: 1,
            quantity: 1,
        },
        {
            ID: 'burger_cheese_double',
            name: 'Double Cheeseburger',
            price: 3.99,
            currency: 'USD',
            position: 2,
            quantity: 1,
        },
    ]
});

View Search Result

Airbridge.event.viewSearchResult({
    query: 'Coke Zero',
    products: [
        {
            ID: 'coke_zero',
            name: 'Coke Zero',
            price: 1.99,
            currency: 'USD',
            position: 1,
            quantity: 1,
        },
        {
            ID: 'burger_cheese_double',
            name: 'Double Cheeseburger',
            price: 3.99,
            currency: 'USD',
            position: 2,
            quantity: 1,
        },
    ],
});

Add to cart

Airbridge.event.addToCart({
    cartID: 'ID-1234567890',
    products: [
        {
            ID: 'coke_zero',
            name: 'Coke Zero',
            price: 1.99,
            currency: 'USD',
            position: 1,
            quantity: 1,
        },
        {
            ID: 'burger_cheese_double',
            name: 'Double Cheeseburger',
            price: 3.99,
            currency: 'USD',
            position: 2,
            quantity: 1,
        },
    ],
    currency: 'USD',
    total: 5.98,
});

Purchase

Airbridge.event.purchase({
    transactionID: '1234567890',
    products: [
        {
            ID: 'coke_zero',
            name: 'Coke Zero',
            price: 1.99,
            currency: 'USD',
            position: 1,
            quantity: 1,
        },
        {
            ID: 'burger_cheese_double',
            name: 'Double Cheeseburger',
            price: 3.99,
            currency: 'USD',
            position: 2,
            quantity: 1,
        },
    ],
    isInAppPurchase: true,
    currency: 'USD',
    total: 5.98,
});

Verify Event Transmission

Make sure that the events are being properly sent through the SDK.

  1. Send an event with the SDK.
  2. Check if the event shows up at "Airbridge dashboard → Raw Data → Web Real-time Logs".



Advanced Setup


Session Timeout

Configure the sessionTimeoutSeconds parameter of airbridge.json.

Session timeout is in milliseconds and must range between 0 and 604800000 (7 days).
Default value is 1000 60 5 (5 minutes).


Hash User Indentifier

Email addresses and phone numbers are hashed by default. (SHA256)
Configure the userInfoHashEnabled parameter of airbridge.json.


Track Facebook Deferred App Links

The Airbridge SDK can track Facebook deferred App Links through the following settings.

  1. Install the Facebook SDK: https://developers.facebook.com/docs/ios/getting-started.
  2. Set facebookDeferredAppLinkEnabled of airbridge.json to true.

Track Airbridge Deep Links Only

The SDK will send all deep link events when the app is opened using a deep link.

When trackAirbridgeLinkOnly of Airbridge API Reference is true, the SDK will only send deep link events that use "Airbridge deep links".


Opt-Out

When autoStartTrackingEnabled of airbridge.json is set to false, the Airbridge SDK will not send events to the Airbridge server until the Airbridge.state.startTracking method is called.

Airbridge.state.startTracking()

Tracking Authorize Timeout (iOS only)

When the AppTrackingTransparency.framework is used to present an app-tracking authorization request to the user, IDFA will not be collected when the install event occurs because the install event occurs before the selection.

When trackingAuthorizeTimeoutSeconds of airbridge.json is set to true, the install event will be sent after the timeout period or delayed until an ATT option is selected.


Tracking Link Execution

Use the code below to execute and track deep links in the app.

Airbridge.placement.click('https://abr.ge/~~~', 'ablog://main', 'https://airbridge.io');
Airbridge.placement.impression('https://abr.ge/~~~');

click

The click function adds a "click" statistic to the corresponding tracking link, then moves to the pre-set app, web or fallback.
Call the click function when the tracking link is clicked on.

The deep link and fallback are "backup links" used when there is no Internet connection.
Deep link parameters are only available in Custom URL Scheme format.
(All these parameters are optional)

impression

The impression function adds an "impression" statistic to the corresponding tracking link.
Call the impression function when the tracking is displayed.

If you are using a "custom domain" for your tracking link, it can not be used with a "custom short ID".
example: http://deeplink.customdomain.com/custom -> Not possible
example: http://deeplink.customdomain.co/autogenerated -> Possible
example: https://abr.ge/autogenerated -> Possible


Get deviceUUID

await Airbridge.state.deviceUUID()



Migration


When updating the Airbridge SDK from a previous version, please proceed with the following.


1.1.X => 1.2.X

npm

Change version of Airbridge React Native SDK in package.json.

...
    "airbridge-react-native-sdk": "1.2.1",
...

Execute the following command.

npm install
cd ios
pod install
npm install
react-native link airbridge-react-native-sdk

Android

  1. Modify android/app/src/main/java/.../MainActivity
-     AirbridgeRN.getDeeplink().fetch(getIntent())
+     AirbridgeRN.processDeeplinkData(getIntent())

iOS

  1. Modify ios/[Project Name]/AppDelegate
-     AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url, withSourceBundle: sourceApplication)
+     AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url)

Settings

  1. Add an airbridge.json file to the project folder.
  2. Add the parameters shown in the example below in JSON format.
{
    "sessionTimeoutSeconds": 300,
    "autoStartTrackingEnabled": true,
    "userInfoHashEnabled": true,
    "trackAirbridgeLinkOnly": false,
    "facebookDeferredAppLinkEnabled": false,
    "locationCollectionEnabled": false
    "trackingAuthorizeTimeoutSeconds": 0
}
Description

Name

Type

Default

Description

sessionTimeoutSeconds

number

300

An app open event will not be sent when the app is reopened within the designated period.

autoStartTrackingEnabled

boolean

true

When set to false, no events will be sent until airbridge.state.startTracking() is called.

userInfoHashEnabled

boolean

true

When set to false, user email and user phone information are sent without being hashed.

trackAirbridgeLinkOnly

boolean

false

When set to true, deep link events are sent only when app is opened with an Airbridge deep link.

facebookDeferredAppLinkEnabled

boolean

false

When set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected.

locationCollectionEnabled

boolean

false

When set to true, location information is collected. (Android Only)

Two permissions must be allowed in AndroidManifest.xml
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION

trackingAuthorizeTimeoutSeconds

number

0

When set timeout, Install event is delayed until Request tracking authorization alert is clicked. (iOS only)


1.0.X => 1.1.X

Installation

Uninstall the old version of the Airbridge SDK.

npm uninstall react-native-airbridge-bridge

Install the new version of the Airbridge SDK.

npm install --save airbridge-react-native-sdk

After Installation, execute the following command.

cd ios
pod install
react-native link airbridge-react-native-sdk

setDeeplinkListener

Remove the getInitialDeeplink function and use the setDeeplinkListener function only.

- Airbridge.deeplink.getInitialDeeplink().then((deeplink) => {
-
- });
. 
. Airbridge.deeplink.setDeeplinkListner((deeplink) => {
. 
. });

Android

AndroidManifest.xml

In the MainActivity section of the android/app/src/main/AndroidManifest.xml file, add intent-filter parameters as below.

+ <intent-filter android:autoVerify="true">
+     <action android:name="android.intent.action.VIEW" />
+
+     <category android:name="android.intent.category.DEFAULT" />
+     <category android:name="android.intent.category.BROWSABLE" />
+
+     <data android:scheme="http" android:host="APP_NAME.deeplink.page" />
+     <data android:scheme="https" android:host="APP_NAME.deeplink.page" />
+ </intent-filter>
. <intent-filter android:autoVerify="true">
.     <action android:name="android.intent.action.VIEW" />
. 
.     <category android:name="android.intent.category.DEFAULT" />
.     <category android:name="android.intent.category.BROWSABLE" />
. 
.     <data android:scheme="http" android:host="APP_NAME.airbridge.io" />
.     <data android:scheme="https" android:host="APP_NAME.airbridge.io" />
. </intent-filter>
. <intent-filter>
.     <action android:name="android.intent.action.VIEW" />
. 
.     <category android:name="android.intent.category.DEFAULT" />
.     <category android:name="android.intent.category.BROWSABLE" />
. 
.     <data android:scheme="EXAMPLE_SCHEME" />
. </intent-filter>
MainActivity.java

Modify android/app/src/main/java/.../MainActivity.java as below.

. import co.ab180.airbridge.reactnative.AirbridgeRN;
. 
. public class MainActivity extends ReactActivity {
+     @Override
+     protected void onResume() {
+         super.onResume();
+ 
+         AirbridgeRN.getDeeplink().fetch(getIntent());
+     }
+  
.     @Override
.     public void onNewIntent(Intent intent) {
.         super.onNewIntent(intent);
.         setIntent(intent);
.     }
. }

iOS

Universal Link
  1. Go to "Xcode → Project file → Signing & Capabilities".
  2. Click "+ Capability" and add "Associated Domains".
  3. Add applinks:YOUR_APP_NAME.deeplink.page to "Associated Domains".

YOUR_APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name".

AppDelegate.m`

Modify ios/.../AppDelegate.m as below.

. - (BOOL)application:(UIApplication *)application
.             openURL:(NSURL *)url
.             options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
. {
-     [AirbridgeRN.instance handleURLSchemeDeeplink:url
-                                withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
+     [AirbridgeRN.deeplink handleURLSchemeDeeplink:url
+                                withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
. 
.     return YES;
. }
. 
. - (BOOL)application:(UIApplication*)application
.             openURL:(NSURL*)url
.   sourceApplication:(NSString*)sourceApplication 
.          annotation:(id)annotation
. {
-     [AirbridgeRN.instance handleURLSchemeDeeplink:url
-                                withSourceBundle:sourceApplication];
+     [AirbridgeRN.deeplink handleURLSchemeDeeplink:url
+                                withSourceBundle:sourceApplication];
. 
.     return YES;
. }

When targeting iOS 8.x or earlier, also make the following changes.

. -  (BOOL)application:(UIApplication*)application
. continueUserActivity:(NSUserActivity*)userActivity
.   restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
. {
-     [AirbridgeRN.instance handleUniversalDeeplink:userActivity.webpageURL];
+     [AirbridgeRN.deeplink handleUniversalLink:userActivity.webpageURL];
. 
.     return YES;
. }

0.2.X => 1.X.X

Reinstalling the Airbridge SDK

Unlink the old version of the SDK.

react-native unlink react-native-airbridge-bridge

Follow the steps below when an error occurs with react-native unlink react-native-airbridge-bridge

  1. (Android) Modify android/app/src/main/java/.../MainApplication.java as below.
- import com.reactlibrary.AirbridgeBridgePackage;
. @Override
. protected List<ReactPackage> getPackages() {
.     return Arrays.<ReactPackage>asList(
+         new MainReactPackage()
-         new MainReactPackage(),
-         new AirbridgeBridgePackage()
.     );
. }
  1. (iOS) Open ios/xxx.xcodeproj.
  2. (iOS) Remove AirbridgeBridge.xcodeproj in Libraries

Uninstall the old version of the SDK.

npm uninstall react-native-airbridge-bridge

Install the new version of the SDK.

npm install --save airbridge-react-native-sdk

Link the new version of the SDK.

react-native link airbridge-react-native-sdk

index.js

Modify index.js as below.

- const Airbridge = require('react-native-airbridge-bridge');
+ import Airbridge from 'airbridge-react-native-sdk';

build.gradle (Android)

Modify android/app/build.gradle as below.

. dependencies {
.     ...
-     implementation 'io.airbridge:sdk-android:1.5.+'
-     implementation 'com.android.installreferrer:installreferrer:1.0'
.     ...
. }

AndroidManifest.xml (Android)

Modify android/app/src/main/AndroidManifest.xml as below.

permission (Android)
-     <uses-permission android:name="android.permission.INTERNET" />
-     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
MainActivity
.     <activity android:name=".MainActivity"
          ...
+         android:launchMode="singleTask">

MainApplication.java (Android)

Modify android/app/src/main/java/.../MainApplication.java as below.

- import io.airbridge.*;
. @Override
. public void onCreate() {
.     super.onCreate();
-     AirBridge.init(this, "[APP_NAME]", "[APP_TOKEN]");
+     AirbridgeRN.init(this, "[APP_NAME]", "[APP_TOKEN]");
.     ...
. }

MainActivity.java (Android)

Modify android/app/src/main/java/.../MainActivity.java as below.

+ import co.ab180.airbridge.reactnative.AirbridgeRN;

+ public class MainActivity extends ReactActivity {
+   @Override
+   public void onNewIntent(Intent intent) {
+       super.onNewIntent(intent);
+       setIntent(intent);
+   }

Podfile (iOS)

Modify ios/Podfile as below.

target '[프로젝트 이름]' do
-   pod 'AirBridge', '1.6.2'
end

Run the command below in terminal.

pod install

AppDelegate.m (iOS)

Modify ios/.../AppDelegate.m as below.

- #import <AirBridge/AirBridge.h>
+ #import <AirbridgeRN/AirbridgeRN.h>
.           - (BOOL)application:(UIApplication *)application 
. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
. {
-     [AirBridge getInstance:@"APP_TOKEN" appName:@"APP_NAME" withLaunchOptions:launchOptions];
+     [AirbridgeRN getInstance:@"APP_TOKEN" appName:@"APP_NAME" withLaunchOptions:launchOptions];
.     ...
. }
. - (BOOL)application:(UIApplication *)application
.             openURL:(NSURL *)url
.             options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
. {
-     [[AirBridge instance] handleURL:url];
+     [AirbridgeRN.instance handleURLSchemeDeeplink:url withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];.
.
.     return YES;
. }
. - (BOOL)application:(UIApplication *)application 
.             openURL:(NSURL *)url
.   sourceApplication:(NSString *)sourceApplication 
.          annotation:(id)annotation
. {
-     [[AirBridge instance] handleURL:url];
+     [AirbridgeRN.instance handleURLSchemeDeeplink:url withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
. 
.     return YES;
. }

When targeting iOS 8.x or earlier, also make the following changes.

.   - (BOOL)application:(UIApplication *)application 
.  continueUserActivity:(NSUserActivity *)userActivity
.    restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
. {
-     [[AirBridge instance] handleURL:url];
+     [AirbridgeRN.instance handleUniversalDeeplink:userActivity.webpageURL];
. 
.     return YES;
. }