Install airbridge-react-native-sdk using npm.
npm install --save airbridge-react-native-sdkExecute the following command.
cd ios
pod installreact-native link airbridge-react-native-sdkAdd the following code to the index.js file of the project to import the Airbridge SDK.
import Airbridge from 'airbridge-react-native-sdk';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, "YOUR_APP_NAME", "YOUR_APP_SDK_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".
Add the following code to the import section of the ios/[Project Name]/AppDelegate.m file.
#import <AirbridgeRN/AirbridgeRN.h>import AirbridgeRNAttention
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:@"YOUR_APP_TOKEN" appName:@"YOUR_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".
Create an airbridge.jsonfile in the project folder.
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.
{
"sessionTimeoutSeconds": 300,
"autoStartTrackingEnabled": true,
"userInfoHashEnabled": true,
"trackAirbridgeLinkOnly": false,
"facebookDeferredAppLinkEnabled": false,
"metaInstallReferrer": "YOUR_META_APP_ID",
"sdkSignatureSecretID": "YOUR_SDK_SIGNATURE_SECRET_ID",
"sdkSignatureSecret": "YOUR_SDK_SIGNATURE_SECRET",
"locationCollectionEnabled": false,
"trackingAuthorizeTimeoutSeconds": 30,
"logLevel": "warning"
}Attention
trackingAuthorizeTimeoutSecondsin the above code is the default value. Please adjust accordingly depending on your user experience and ATT prompt settings. Please refer to Tracking Authorize Timeout Settings for more details.
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
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) |
trackingAuthorizeTimeoutSeconds | Number | 0 | When timeout is set, Install event is delayed until
is clicked. (iOS only) |
sdkSignatureSecretID | String | null | Protects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied. |
sdkSignatureSecret | String | null | Protects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied. |
logLevel | String | Warning | Adjusts the log record level for Airbridge. |
Check if install events are sent when the application is installed and opened.
Events from the Airbridge SDK are shown at the "Airbridge Dashboard → Raw Data → App Real-time Logs".
Go to the "Airbridge Dashboard → Raw Data → App Real-time Logs".
Search for the device's ADID (IDFA, IDFV, GAID).
Logs may be delayed for up to 5 minutes.
Please refer to the following guides for setting up deep links in the Airbridge dashboard.
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 will 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.
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="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="YOUR_SCHEME" />
</intent-filter>
...
<activity/>Enter your app name at APP_NAME.
Enter your scheme value set in the Airbridge dashboard at YOUR_SCHEME.
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);
}Go to "Xcode → Project file → Info → URL Types".
From the Airbridge dashboard, copy "iOS URI Scheme" to Xcode's "URL Schemes". (Do not include://)
Go to "Xcode → Project file → Signing & Capabilities".
Click "+ Capability" and add "Associated Domains".
Add applinks:YOUR_APP_NAME.airbridge.ioto "Associated Domains".
Add applinks:YOUR_APP_NAME.deeplink.pageto "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.
2. Send deeplink information to the SDK when the application is opened through schemes by calling the handleURLSchemeDeeplinkmethod 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
}3. When targeting iOS 8.x or earlier, also call the handleURLSchemeDeeplinkmethod 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;
}4. Send deep link information to the SDK when the application is opened through an universal link by calling the handleUserActivitymethod 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 handleUserActivity:userActivity];
return YES;
}func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
{
AirbridgeRN.deeplink().handle(userActivity)
return true
}Please refer to the below guides to setup your custom domain with Airbridge.
iOS: Guide
Android: Guide
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.
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 | - |
User Email | Hashed by default | |
phone | User phone number | Hashed by default |
attributes | User attributes | - Maximum 100 attributes |
alias | Another User ID | - Maximum 10 aliases |
Airbridge.state.setUser({
ID: 'persondoe1',
email: 'persondoe1@example.com',
});
Airbridge.state.setUser({
email: 'persondoe2@example.com',
phone: '+14151231234',
});
Airbridge.state.updateUser({
ID: 'persondoe3',
});The above code operates in the following order.
User = { ID: 'personID1', email: 'persondoe1@airbridge.io' }
User = { ID: 'personID1', email: 'persondoe1@airbridge.io', phone: '1(123)123-1234' }
User = { ID: 'personID3', email: 'persondoe2@airbridge.io', phone: '1(123)123-1234)' }
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"
}
});Make sure that your user information settings are being properly sent through the SDK.
Configure user identifier information.
Send an event using the SDK.
Click the event at "Airbridge dashboard → Raw Data → App Real-time Logs"
Check if the user information is correctly sent under the userblock.
Setup a device alias through the Airbridge SDK. The alias will be sustained even after the app closes, unless otherwise deleted.
Airbridge.setDeviceAlias("ADD_YOUR_KEY", "AND_YOUR_VALUE");
Airbridge.removeDeviceAlias("DELETE_THIS_KEY");
Airbridge.clearDeviceAlias();
| Add the key value pair to the device identifier. |
| Delete the corresponding device alias. |
| Delete all device aliases. |
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.
action, label, value, customAttributes and semanticAttributes can be used for event options.
/**
* Send event to server.
* @param {string} category event name
* @param {EventOption} [option={}] event options
*/
trackEvent(category: string, option?: EventOption): void;Send user events with the SDK.
action, label, value, customAttributes and semanticAttributes can be used for user events.
User identifiers are set with setUser and then sent with AirbridgeCategory.SIGN_UP for user sign ups.
Airbridge.state.setUser({
ID: 'test',
email: 'test@ab180.co',
phone: '000-0000-0000',
});
Airbridge.trackEvent(AirbridgeCategory.SIGN_UP);User identifiers are set with setUser and then sent with AirbridgeCategory.SIGN_IN for user logins.
Airbridge.state.setUser({
ID: 'test',
email: 'test@ab180.co',
phone: '000-0000-0000',
});
Airbridge.trackEvent(AirbridgeCategory.SIGN_IN);Send the sign out event with AirbridgeCategory.SIGN_OUT, and then reset the user identifiers with Airbridge.state.setUser({}).
Airbridge.trackEvent(AirbridgeCategory.SIGN_OUT);
Airbridge.state.setUser({});action, label, value, customAttributes and semanticAttributes can be used for e-commerce events.
It is possible to include product information using semanticAttributes. Custom key values can be used along with the pre-defined values.
Airbridge.trackEvent(AirbridgeCategory.HOME_VIEW);Airbridge.trackEvent(AirbridgeCategory.PRODUCT_DETAILS_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});Airbridge.trackEvent(AirbridgeCategory.PRODUCT_LIST_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.PRODUCT_LIST_ID]: 'ID-1234567890'
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});Airbridge.trackEvent(AirbridgeCategory.SEARCH_RESULT_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.QUERY]: 'product'
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});Airbridge.trackEvent(AirbridgeCategory.ADD_TO_CART, {
value: 5.98,
semanticAttributes: {
[AirbridgeAttributes.CART_ID]: 'ID-1234567890',
[AirbridgeAttributes.CURRENCY]: 'USD',
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});Airbridge.trackEvent(AirbridgeCategory.ORDER_COMPLETED, {
value: 5.98,
semanticAttributes: {
[AirbridgeAttributes.TRANSACTION_ID]: 'transactionID-purchase',
[AirbridgeAttributes.CURRENCY]: 'USD',
[AirbridgeAttributes.IN_APP_PURCHASED]: true,
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});Make sure that the events are being properly sent through the SDK.
Send an event with the SDK.
Check if the event shows up at "Airbridge dashboard → Raw Data → Web Real-time Logs".
Restricted SDK does not collect device IDs, including Ad ID. The restricted SDK will be available starting from v2.5.3.
npm install --save airbridge-react-native-sdk-restrictedcd ios
pod installreact-native link airbridge-react-native-sdk-restrictedObtain the object in the project's index.js file with the following code.
import Airbridge from 'airbridge-react-native-sdk-restricted';Protection against SDK spoofing is possible once you set your SDK Signature.
This feature is available for the Airbridge React Native SDK v2.3.0 and above.
Add the following lines in the airbridge.json file.
{
"sdkSignatureSecretID": "YOUR_SDK_SIGNATURE_SECRET_ID",
"sdkSignatureSecret": "YOUR_SDK_SIGNATURE_SECRET"
}The SDK Signature Credentials are required for the SDK Signature setup. Refer to this article to learn how to create them.
Configure the sessionTimeoutSeconds parameter of airbridge.json. App open events will not be sent again if the user re-opens the app within the sessionTimeoutSeconds value.
Session timeout is in milliseconds and must range between 0 and 604800000 (7 days).
Default value is 1000 * 60 * 5 (5 minutes).
Email addresses and phone numbers are hashed by default. (SHA256)
You can stop hashing email and phone information by configuring the userInfoHashEnabled parameter of airbridge.json.
You must take appropriate measures internally when personal information is not hashed.
The Airbridge SDK can track Facebook Deferred App Links by utilizing the facebookDeferredAppLinkEnabled parameter of airbridge.json.
Install the Facebook SDK:
Set facebookDeferredAppLinkEnabledof airbridge.json to true.
Attention
The Facebook SDK must be configured beforehand. Reference
The SDK will send all deep link events when the app is opened using a deep link.
If you're having difficulty tracking the re-engagement performance due to various deep link actions within the app, set trackAirbridgeLinkOnly of airbridge.json to true. The SDK will only send deep link events that use Airbridge deep links.
Airbridge deep links are defined as...
Deep links registered on the Airbridge dashboard
airbridge.iodeep links
deeplink.pagedeep links
Contains the airbridge_referrerquery information
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.
This feature is useful for compliances such as GDPR and CCPA.
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.
Track a user's location through the locationCollectionEnabled parameter of the airbridge.json file.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />Attention
Location information must be collected for legal purposes only.
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/~~~');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)
The impression function adds an "impression" statistic to the corresponding tracking link.
Call the impression function when the tracking is displayed.
Attention
カスタムドメインを使用している場合、カスタムShort IDを含むトラッキングリンクは使用できません。
example1) http://deeplink.ab180.co/custom → 使用不可
example2) http://deeplink.ab180.co/a3b1c2 → 使用可能
example3) https://abr.ge/a3b1c2 → 使用可能
await Airbridge.state.deviceUUID()This feature is available only for React Native SDK v2.1.0+.
Airbridge Android SDK v2.6.0+
Airbridge iOS SDK v1.28.2+
Please refer to this guide for details.
Airbridge.registerPushToken(token);Forward the push token to Airbridge using the registerPushToken method.
Make sure the notification is not shown on the device if the remote message value is airbridge-uninstall-tracking.
Additional events such as app installs, app open and deep link opens can't be tracked with just the web SDK. The following simple setup allows in-app events to be called for a hybrid app.
let webInterface = Airbridge.createWebInterface(
'YOUR_WEB_TOKEN',
(command) => {
return `...`;
}
)Airbridge.CreateWebInterface allows you to control the web interface.
Please refer to the guide below for more information.
The event API has been replaced to the below.
/**
* Send event to server.
* @param {string} category event name
* @param {EventOption} [option={}] event options
*/
trackEvent(category: string, option?: EventOption): void;Refer to the React native 2.X.X migration guide for details.
An error like below may occur when creating iOS builds with React Native SDK v1.5.0+.
ld: XCFrameworkIntermediates/AirBridge/AirBridge.framework/AirBridge(AirBridge-arm64-master.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)Since React Native SDK v1.5.0+ uses Airbridge iOS SDK v1.28.0+, Bitcode is no longer supported. Please refer to the Bitcode compile error guide for more details.
Reference : Android SDK Auto Backup
If you are experiencing build errors caused by overlapping of the Airbridge SDK backup rules and third-party SDK backup rules, please refer to the workaround below.
e.g) If you have an Airbridge SDK backup rule and an Appsflyer SDK backup rule that overlap, you will see the build error below.
Attribute application@fullBackupContent value=(@xml/appsflyer_backup_rules) from [com.appsflyer:af-android-sdk:6.6.1] AndroidManifest.xml:14:18-73
is also present at [io.airbridge:sdk-android:2.14.0] AndroidManifest.xml:27:18-78 value=(@xml/airbridge_auto_backup_rules).
Suggestion: add 'tools:replace="android:fullBackupContent"' to <application> element at AndroidManifest.xml:7:5-13:19 to override.To resolve this issue, please set up as follows.
Create a android/app/src/main/res/xml folder.
Within the created xml folder, create a file (e.g. custom_backup_rules.xml).
Add the data backup rules defined in the Airbridge SDK as follows.
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<!-- Airbridge Backup Rules -->
<exclude domain="sharedpref" path="airbridge-internal" />
<exclude domain="sharedpref" path="airbridge-install" />
<exclude domain="sharedpref" path="airbridge-user-info" />
<exclude domain="sharedpref" path="airbridge-user-alias" />
<exclude domain="sharedpref" path="airbridge-user-attributes" />
<exclude domain="sharedpref" path="airbridge-device-alias" />
<exclude domain="database" path="airbridge.db" />
<!-- Appsflyer Backup Rules -->
<exclude domain="sharedpref" path="appsflyer-data"/>
<!-- Your Custom Backup Rules -->
</full-backup-content><manifest
...
xmlns:tools="http://schemas.android.com/tools">
<application
...
android:allowBackup="true"
android:fullBackupContent="@xml/custom_backup_rules"
tools:replace="android:fullBackupContent">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 installnpm install
react-native link airbridge-react-native-sdkModify android/app/src/main/java/.../MainActivity
- AirbridgeRN.getDeeplink().fetch(getIntent())
+ AirbridgeRN.processDeeplinkData(getIntent())Modify ios/[Project Name]/AppDelegate
- AirbridgeRN.deeplink().handleURLSchemeDeeplink(url, withSourceBundle: sourceApplication)
+ AirbridgeRN.deeplink().handleURLSchemeDeeplink(url)Add an airbridge.jsonfile to the project folder.
Add the parameters shown in the example below in JSON format.
{
"sessionTimeoutSeconds": 300,
"autoStartTrackingEnabled": true,
"userInfoHashEnabled": true,
"trackAirbridgeLinkOnly": false,
"facebookDeferredAppLinkEnabled": false,
"locationCollectionEnabled": false
}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 |
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) |
trackingAuthorizeTimeoutSeconds | number | 0 | When set timeout, Install event is delayed until Request tracking authorization alert is clicked. (iOS only) |
Uninstall the old version of the Airbridge SDK.
npm uninstall react-native-airbridge-bridgeInstall the new version of the Airbridge SDK.
npm install --save airbridge-react-native-sdkAfter Installation, execute the following command.
cd ios
pod installreact-native link airbridge-react-native-sdkRemove the getInitialDeeplink function and use the setDeeplinkListener function only.
- Airbridge.deeplink.getInitialDeeplink().then((deeplink) => {
-
- });
.
. Airbridge.deeplink.setDeeplinkListner((deeplink) => {
.
. });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="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>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);
. }
. }Go to "Xcode → Project file → Signing & Capabilities".
Click "+ Capability" and add "Associated Domains".
Add applinks:YOUR_APP_NAME.deeplink.pageto "Associated Domains"
YOUR_APP_NAMEはダッシュボードのSettings>Tokens>アプリ名で確認できます。
自動入力機能を使う場合、トラブルシューティング > ウェブクレデンシャルを参照してください。
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;
. }Unlink the old version of the SDK.
react-native unlink react-native-airbridge-bridgeFollow the steps below when an error occurs with react-native unlink react-native-airbridge-bridge
(Android) Modify android/app/src/main/java/.../MainApplication.javaas below.
- import com.reactlibrary.AirbridgeBridgePackage;. @Override
. protected List<ReactPackage> getPackages() {
. return Arrays.<ReactPackage>asList(
+ new MainReactPackage()
- new MainReactPackage(),
- new AirbridgeBridgePackage()
. );
. }2. (iOS) Open ios/xxx.xcodeproj.
3. (iOS) Remove AirbridgeBridge.xcodeprojin Libraries
Uninstall the old version of the SDK.
npm uninstall react-native-airbridge-bridgeInstall the new version of the SDK.
npm install --save airbridge-react-native-sdkLink the new version of the SDK.
react-native link airbridge-react-native-sdkModify index.js as below.
- const Airbridge = require('react-native-airbridge-bridge');
+ import Airbridge from 'airbridge-react-native-sdk';Modify android/app/build.gradle as below.
. dependencies {
. ...
- implementation 'io.airbridge:sdk-android:1.5.+'
- implementation 'com.android.installreferrer:installreferrer:1.0'
. ...
. }Modify android/app/src/main/AndroidManifest.xml as below.
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />. <activity android:name=".MainActivity"
...
+ android:launchMode="singleTask">Modify android/app/src/main/java/.../MainApplication.java as below.
- import io.airbridge.*;. @Override
. public void onCreate() {
. super.onCreate();
- AirBridge.init(this, "[앱 이름]", "[앱 토큰]");
+ AirbridgeRN.init(this, "[앱 이름]", "[앱 토큰]");
. ...
. }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);
+ }
+ }Modify ios/Podfile as below.
target '[Project Name]' do
- pod 'AirBridge', '1.6.2'
endRun the command below in terminal.
pod installModify ios/.../AppDelegate.m as below.
- #import <AirBridge/AirBridge.h>
+ #import <AirbridgeRN/AirbridgeRN.h>. - (BOOL)application:(UIApplication *)application
. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
. {
- [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN(앱 토큰)" appName:@"YOUR_APP_NAME(앱 이름)" withLaunchOptions:launchOptions];
+ [AirbridgeRN getInstance:@"YOUR_APP_SDK_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;
. }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;
. }このページは役に立ちましたか?