React Native SDK

React Native SDK

Installlink

Install - JSlink

npmlink

Install react-native SDK using npm.

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

After Installation, execute the following command.

react-native link airbridge-react-native-sdk

importlink

Acquire SDK objects through the following code in the index.js of the project.

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

Install - Androidlink

  • The modules below will be installed automatically.
    • io.airbridge:sdk-android
    • com.android.installreferrer:installreferrer
  • The privileges below will be added automatically.
    • android.permission.INTERNET
    • android.permission.ACCESS_NETWORK_STATE

1. Proguardlink

If you are using Proguard check the following information.
Add the following text to the 'android/app/proguard-rules.pro' file:

-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {public *;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info { public *;}
-keep class com.android.installreferrer.api.InstallReferrerClient {public *;}
-keep class com.android.installreferrer.api.InstallReferrerClient$newBuilder { public *;}
-keep class com.android.installreferrer.api.InstallReferrerClient$Builder { public *;}
-keep class com.android.installreferrer.api.ReferrerDetails {public *;}
-keep class com.android.installreferrer.api.InstallReferrerStateListener {public *;}
-keep class io.airbridge.deviceinfo.** { *; }
-keepclassmembers class io.airbridge.** { public *; }
-keep public class io.airbridge.**

MainApplication.javalink

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

@Override
public void onCreate() {
super.onCreate();
AirbridgeRN.init(this, "[App name]", "[App token]");
...
}

'App name' can be found on the dashboard at 'App Setting > App Info'.
App token' can be found on the dashboard at 'App Setting > Tokens Management'.

Install - iOSlink

AppDelegate.mlink

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

#import <AirbridgeRN/AirbridgeRN.h>

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

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
...
}

'App name' can be found on the dashboard at 'App Setting > App Info'.
App token' can be found on the dashboard at 'App Setting > Tokens Management'.

Register the information in your app to the Airbridge dashboard to use the Deeplink feature.
On the Airbridge dashboard, click the Deeplinks menu in the sidebar and you will see the screen as shown below.

deeplinks en

Schemelink

  1. Enter the desired scheme in the Android URL scheme area of the Deeplink registration part picture by attaching "://"

example) scheme://

  1. Prepare the signing key you used when signing up for the Google Play Store.

  2. Run the following code.

keytool -list -v -keystore my-release-key.keystore
  1. Copy the SHA256 column of the certificate fingerprints and Enter Android sha256_cert_fingerprints area of the deeplink registration part.

ex) 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5

Schemelink

  1. Enter the desired scheme in the iOS URI scheme area of the Deeplink registration part picture by attaching "://"

example) scheme://

  1. Connect to the link below.

  2. Click the app name of the project.

  3. Copy the string in the Prefix and ID area of the picture below and enter the string Prefix + "." + ID in the iOS App ID area of the picture in the part.

Example) 9JA89QQLNQ.com.apple.wwdc

ios app id

Set up the app to use deeplink.

setDeeplinkListenerlink

Register a callback called when Deeplink or Deferred Deeplink occurs.

Airbridge.deeplink.setDeeplinkListener((deeplink) => {
// Code to be executed when a `Deeplink` or `Deferred Deeplink` occurs
// deeplink = https://appname.airbridge.io/...
console.log(deeplink);
});

setDeferredDeeplinkListener (Option)link

Register a callback called when Deferred Deeplink occurs.

Airbridge.deeplink.setDeferredDeeplinkListener((deeplink) => {
// Code to be executed when a `Deferred Deeplink` occurs
// deeplink = https://appname.airbridge.io/...
console.log(deeplink);
});

AndroidManifest.xmllink

In the MainActivity area of the file android/app/src/main/AndroidManifest.xml, insert the sentence android:LaunchMode and intent-filter as shown 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="YOUR_APP_NAME.deeplink.page" />
<data android:scheme="https" android:host="YOUR_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="YOUR_APP_NAME.airbridge.io" />
<data android:scheme="https" android:host="YOUR_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>
...
<activity/>

Enter the app name to YOUR_APP_NAME
Enter the scheme value set in the dashboard to EXAMPLE_SCHEME

MainActivity.javalink

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

@Override
protected void onResume() {
super.onResume();
AirbridgeRN.getDeeplink().fetch(getIntent());
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}

Xcodelink

Schemelink

  1. Xcode > Project file > Info > URL Types.
  2. Put scheme value set in the dashboard to identifier and URL Schemes.

ios url scheme

Remove the :// and insert it.

  1. Xcode > Project File > Signing & Capabilities > Associated Domains.
  2. Click + button and add applinks:YOUR_APP_NAME.airbridge.io.
  3. Click + button and add applinks:YOUR_APP_NAME.deeplink.page.

'YOUR_APP_NAME' can be found on the dashboard at 'App Setting > App Info'.

AppDelegate.mlink

Schemelink

  1. Open ios/[Project Name]/AppDelegate.m file.
  2. Insert below code.
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
{
NSLog(@"openURL : %@", url);
[AirbridgeRN.deeplink handleURLSchemeDeeplink:url
withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
return YES;
}
  1. If you are targeting iOS 8.x or earlier, insert the following additional code.
- (BOOL)application:(UIApplication*)application
openURL:(NSURL*)url
sourceApplication:(NSString*)sourceApplication
annotation:(id)annotation
{
NSLog(@"openURL : %@", url);
[AirbridgeRN.deeplink handleURLSchemeDeeplink:url
withSourceBundle:sourceApplication];
return YES;
}
  1. Open ios/[Project Name]/AppDelegate.m file.
  2. Insert below code.
- (BOOL)application:(UIApplication*)application
continueUserActivity:(NSUserActivity*)userActivity
restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
{
NSLog(@"continueUserActivity : %@", url);
[AirbridgeRN.deeplink handleUniversalLink:userActivity.webpageURL];
return YES;
}

Verify Installation Completionlink

  1. Delete the app from the test device.
  2. Reinstall the app and run the app on the same test device.
  3. Press on Realtime Log under Airbridge Dashboard → Select Apps → Log Data.
  4. Press Mobile SDK Log and enter Android GAID or iOS IDFA in Device UUID..
  • If device UUID (Android GAID or iOS IDFA) exposure is not confirmed, please re-check that it is installed as directed in install.
  • Log exposure can be delayed by up to 5 minutes.
  • Confirm Android GAID: 'Setup' → Google Setup → Advertise → 'Check My Advertisement ID' is the value of Android GAID.

In app eventlink

You can measure various user journey events through the Android SDK.

There are 9 basic events related to users' information and e-commerce user journeys. Custom events can be additionally defined as well. Information that is attached to all events can be additionally added.

You would be able to track and analyze more accurate statistics if you include more event information.

EventOption objectlink

All events in Airbridge can be specified through EventOption.

NameTypeOptionalDescription
actionstringOptionalEvent subclass 1
labelstringOptionalEvent subclass 2
valuestringOptionalEvent custom value
attributesObjectOptionalEvent custom information

About action, label, check in-app event classification part.

In-app event - Userlink

User in-app events are a component of 'Cross Platform User Matching'.
If possible, please send more than one type of user information.

When sign-up or sign-in event occurs,
until the next sign-out event occurs, all events are recorded as being triggered by that user.

When sign-out event occurs,
all events until the next sign-in event are recorded without that user-related data.

All user information is sent by default in a hashed format (SHA256).

User objectlink

Object that has product information.

NameTypeOptionalDescription
IDstringOptionalUser ID
emailstringOptionalUser email
phonestringOptionalUser cell-phone-number

Sign uplink

When a user sign-up, call signUp.

signUplink

  1. Send sign-up event.
  2. Setting up users that will be applied to the next events.
Parameter :
NameTypeOptionalDescription
userUserOptionalUser information
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.signUp({
ID: 'test',
email: 'test@ab180.co',
phone: '000-0000-0000',
});

Sign Inlink

When a user sign-in, call signIn.

signInlink

  1. Send sign-in event.
  2. Setting up users that will be applied to the next events.
Parameter :
NameTypeOptionalDescription
userUserOptionalUser information
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.signIn({
ID: 'test',
email: 'test@ab180.co',
phone: '000-0000-0000',
});

Sign Outlink

If the user signs out, call signOut.

signOutlink

  1. Send sign-out event.
  2. Remove users that will be applied to the next events.b

Example codelink

Airbridge.event.signOut();

In-app events - Commercelink

Track the user's commerce-related behavior.

Product objectlink

Object that has product information.

NameTypeOptionalDescription
IDstringOptionalProduct unique ID
namestringOptionalProduct name
currencystringOptionalCurrency
According toISO 4217 standard
pricenumberOptionalProduct price
quantitynumberOptionalProduct quantity
positionnumberOptionalPosition of the products on the list

Home screen lookuplink

When the user navigates to the app's home screen, call viewHome.

viewHomelink

Send home-screen-lookup event.

Example codelink

Airbridge.event.viewHome();

Product list lookuplink

When the user views the product list, call viewProductList.

viewProductListlink

Send product-list-lookup event.

Parameter :link

NameTypeOptionalDescription
listIDstringOptionalUnique ID for a product list
productsArray.<Product>OptionalProduct list
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.viewProductList({
listID: 'ID-1234567890',
products: [
{
name: 'product A',
},
{
name: 'product B',
},
]
});
  • When users scroll through the list and load new information
    Additional loaded product information, it is recommended that create new event and send it separately.

Search results lookuplink

When the user searches for a product, call viewSearchResult.

viewSearchResultlink

Send search-results-lookup event.

Parameter :link

NameTypeOptionalDescription
querystringOptionalSearch term
productsArray.<Product>OptionalProduct list of the search result
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.viewSearchResult({
query: 'product A',
products: [
{
name: 'product A AAA',
},
{
name: 'product A BBB',
},
],
});

Product details lookuplink

When user views the details of the product, call viewProductDetail.

viewProductDetaillink

Send product-details-lookup event.

Parameter :link

NameTypeOptionalDescription
productsArray.<Product>OptionalProduct list of lookup
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.viewProductDetail({
products: [
{
name: 'product A',
},
],
});

Add to shopping cartlink

When user adds the product in the cart, call addToCart.

addToCartlink

Send add-to-shopping-cart event.

Parameter :link

NameTypeOptionalDescription
cartIDstringOptionalUnique ID of shopping cart
productsArray.<Product>OptionalProduct list of shopping cart
currencystringOptionalCurrency
According to ISO 4217 standard
totalnumberOptionalTotal price of products
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.addToCart({
cartID: 'ID-1234567890',
products: [
{
name: 'product A',
},
],
currency: 'KRW',
total: 50000,
});

Purchaselink

When user purchase, call purchase.

purchaselink

Send purchase event.

Parameter :link

NameTypeOptionalDescription
transactionIDstringOptionalUnique ID of purchase
productsArray.<Product>OptionalProduct list of shopping cart
isInAppPurchasebooleanOptionalIs from in-app-purchase?
currencystringOptionalCurrency
According to ISO 4217 standard
totalnumberOptionalTotal price of products
optionEventOptionOptionalEvent additional information

Example codelink

Airbridge.event.purchase({
transactionID: 'transactionID-purchase',
products: [
{
name: 'product purchase A name',
ID: 'product purchase A ID',
price: 100,
quantity: 10,
},
],
isInAppPurchase: true,
currency: 'KRW',
total: 50000,
});

In-app Event - Customlink

Customize and use in-app event.

customlink

Send custom event.

Parameter :link

NameTypeOptionalDescription
categorystringRequiredEvent name
optionEventOptionOptionalEvent additional information

Example codelink

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

Settingslink

Set the behavior of the Airbridge SDK according to the developer's intention.

In-app event classificationlink

The Airbridge dashboard displays statistics by separating events according to Category, Action, and Label.

Category is a name that you choose as a way to group events that you want to analyze.
Action is used to define the subgroups for a particular event Category.
Label is used to further define the subgroups for a particular Action.

For all in-app events, you can modify Action and Label.

Example codelink

for(var i=0; i<10; i++) {
Airbridge.event.signUp({
ID: 'test'
}, {
action: 'Seoul',
label: '30s',
});
}
for(var i=0; i<20; i++) {
Airbridge.event.signUp({
ID: 'test'
}, {
action: 'Seoul',
label: '40s',
});
}
for(var i=0; i<15; i++) {
Airbridge.event.signUp({
ID: 'test'
}, {
action: 'Busan',
label: '30s',
});
}
for(var i=0; i<8; i++) {
Airbridge.event.purchase({
transactionID: 'ID-1234567890',
}, {
action: 'Product A',
label: 'Option B',
});
}
for(var i=0; i<7; i++) {
Airbridge.event.purchase({
transactionID: 'ID-1234567890',
}, {
action: 'Product A',
label: 'Option C',
});
}
for(var i=0; i<10; i++) {
Airbridge.event.custom('Subscription', {
action: 'Normal',
});
}
for(var i=0; i<5; i++) {
Airbridge.event.custom('Subscription', {
action: 'Premium',
});
}

You can view statistics for the count of each event based on Category in the Airbridge dashboard.
You can view statistics by separating the events in the same Category with the action and then separating the events through the label.

As a result, you can get the following results on the dashboard.

CategoryActionLabelCount
Sign upSeoul30s10
Sign upSeoul40s20
Sign upBusan30s15
PurchaseProduct AOption B8
PurchaseProduct AOption C7
SubscriptionNormal10
SubscriptionPremium5

Session durationlink

The default value of session duration in Airbridge is 5 minutes.

You can set the session period by calling the code below.

...
[AirbridgeRN setSessionTimeout:(1000 * 60 * 5)];
[AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
...

The session period is in milliseconds. The maximum value is 604800000 (7 days).

Both Android and iOS should be set before initialization.

Disable hashing of user informationlink

All information about the user is by default sent in a hashed format (SHA256).

If you do not want to hash the information, you can use the method below to change the settings.

...
// Disable user information hash
[AirbridgeRN setIsUserInfoHashed:NO];
[AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
...

Both Android and iOS should be set before initialization.

Stop tracking (Opt-out)link

You can stop sending events from the SDK.

...
// Stop tracking
[AirbridgeRN setIsTrackingEnabled:NO];
[AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
...

true : Tracking
false : Stop Tracking

Both Android and iOS should be set before initialization.

Additional Collectionlink

You can gather more additional information.

User carrier name collection (Android)link

You can collect the name of the android user's carrier.

Add the following permissions to the android/app/src/main/AndroidManifest.xml file.

...
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
...

This setting increases the accuracy of cross-platform user matching.

You can use the code below to perform deeplink actions on the App and track the behavior.

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

clicklink

click function +1 click statistic for the tracking link and moves to the set App, Web, or Fallback.
When the tracking link is clicked, call click function.

In click function, deeplink and fallback are backup links used when there is no Internet connection.
(All of these are optional parameters.)
Deeplink parameters are only available in Custom URL Scheme format.

Impressionlink

impression function +1 impression statistic for the 'tracking link'.
When the tracking link is displayed on the UI, call impression function.

If you are using custom domain, you cannot use tracking link using custom short ID.
example: http://deeplink.ab180.co/custom -> Unavailable
example: http://deeplink.ab180.co/a3b1c2 -> Available
example: https://abr.ge/a3b1c2 -> Available

Advancedlink

Manual setting for user informationlink

Even without sign-up, sign-in and sign-out events, you can still set the user information manually.

When user information is set manually, until next setting or using the function signIn, signUp, and signOut. all events are recorded as being triggered by the user.

setUserlink

Change the current user.

Parameter :link

NameTypeOptionalDescription
userUserOptionalUser information

Replace the current user with the user entered.

updateUserlink

Modify the current user information.

Parameter :link

NameTypeOptionalDescription
userUserOptionalUser information

If the user entered has no ID value, the ID of the current user is not modified. If the user entered has an ID value, modify the ID of the current user.

Example codelink

Airbridge.state.setUser({
ID: 'test1',
email: 'test1@ab180.co',
});
Airbridge.state.setUser({
email: 'test2@ab180.co',
phone: '222-2222-2222',
});
Airbridge.state.updateUser({
ID: 'test3',
});

The code above works as follows.

User = { ID: 'test1', email: 'test1@ab180.co' }
-> User = { email: 'test1@ab180.co', phone: '222-2222-2222' }
-> User = { ID: 'test3', email: 'test2@ab180.co', phone: '222-2222-2222' }

Braze Integrationlink

Use SDK to SDK method to send Airbridge attribution information to Braze.

iOSlink

#import <AirBridge/AirBridge.h>
...
@interface AppDelegate () <ABTrackingDelegate>
@end
@implementation AppDelegate
...
- (void)airbridgeUserAttributed:(ABAttribution *)attribution {
/* convert airbridge-attribution to braze-attribution */
ABKAttributionData *abkAttributionData = [[ABKAttributionData alloc] initWithNetwork:attribution.source
campaign:attribution.campaign
adGroup:attribution.adgroup
creative:attribution.adcreative];
/* add attribution-data to user */
[[[Appboy sharedInstance] user] setAttributionData:abkAttributionData];
[[[Appboy sharedInstance] user] setCustomAttributeWithKey:@"airbridge_medium"
andStringValue:attribution.medium];
[[[Appboy sharedInstance] user] setCustomAttributeWithKey:@"airbridge_ad_content"
andStringValue:attribution.adcontent];
[[[Appboy sharedInstance] user] setCustomAttributeWithKey:@"airbridge_search_keyword"
andStringValue:attribution.searchKeyword];
/* send event to Braze */
[[Appboy sharedInstance] flushDataAndProcessRequestQueue];
}
...
@end

Androidlink

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

import io.airbridge.AirBridge;
...
@Override
public void onCreate() {
super.onCreate();
...
/* Braze init */
registerActivityLifecycleCallbacks(new AppboyLifecycleCallbackListener(...));
...
/* Airbridge-ReactNative-SDK init */
AirbridgeRN.init(this, "airbridgern", "10b054eaff51417fbdcff22b9db34b0f");
/* Braze integration with Airbridge-Android-SDK */
AirBridge.turnOnIntegration(new AppBoyIntegrator());
}

The code related to Airbridge-Braze integration should be written below Braze init.

Referencelink

Document

SDK migrationlink

If you are updating the SDK from a previous version, please check below.

1.0.X -> 1.1.Xlink

Installlink

Uninstall the old version of SDK.

npm uninstall react-native-airbridge-bridge

Install the new version of SDK.

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

After Installation, execute the following command.

react-native link airbridge-react-native-sdk

Javascriptlink

DeeplinkListener

Remove the getInitialDeeplink function and use the setDeeplinkListener function only.

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

Androidlink

AndroidManifest.xml

In the MainActivity area of the file android/app/src/main/AndroidManifest.xml, insert the intent-filter as shown 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="YOUR_APP_NAME.deeplink.page" />
+ <data android:scheme="https" android:host="YOUR_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="YOUR_APP_NAME.airbridge.io" />
. <data android:scheme="https" android:host="YOUR_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.

. 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);
. }
. }

iOSlink

Xcode

Universal Link

  1. Xcode > Project File > Signing & Capabilities > Associated Domains.
  2. Click + button and add applinks:YOUR_APP_NAME.deeplink.page.

'YOUR_APP_NAME' can be found on the dashboard at 'App Setting > App Info'.

AppDelegate.m

Modify ios/.../AppDelegate.m.

. - (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;
. }

If you are targeting iOS 8.x or earlier, modify the following additional code.

. - (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.Xlink

1. terminallink

Please unlink the old version of SDK.

react-native unlink react-native-airbridge-bridge

When error on react-native unlink react-native-airbridge-bridge

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

- import com.reactlibrary.AirbridgeBridgePackage;
. @Override
. protected List<ReactPackage> getPackages() {
. return Arrays.<ReactPackage>asList(
+ new MainReactPackage()
- new MainReactPackage(),
- new AirbridgeBridgePackage()
. );
. }

Modify ios/xxx.xcodeproj.

Remove `AirbridgeBridge.xcodeproj` in `Libraries`

Uninstall the old version of SDK.

npm uninstall react-native-airbridge-bridge

Install the new version of SDK.

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

Link the new version of SDK.

react-native link airbridge-react-native-sdk

2. index.jslink

change require to import in index.js.

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

3. Build.gradlelink

Modify android/app/build.gradle.

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

4. AndroidManifest.xmllink

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

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

5. MainApplication.javalink

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

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

6. MainActivity.javalink

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

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

7. Podfilelink

Modify ios/Podfile.

target '[Project name]' do
- pod 'AirBridge', '1.6.2'
end

Run the command below in terminal.

pod install

8. AppDelegate.mlink

Modify ios/.../AppDelegate.m.

- #import <AirBridge/AirBridge.h>
+ #import <AirbridgeRN/AirbridgeRN.h>
. - (BOOL)application:(UIApplication *)application
. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
. {
- [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
+ [AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_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;
. }

If you are targeting iOS 8.x or earlier, modify the following additional code.

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