Android SDK

Android SDK

Installlink

1. build.gradlelink

Open build.gradle file from project’s app module folder (usually named app/) and insert the following into dependencies.

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

If you are in an environment where you cannot use Gradle or the Internet, please check Advanced - SDK Direct Install section.

2. AndroidManifest.xmllink

Please add the following permissions to the app/src/main/AndroidManifest.xml file.

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

3. Proguardlink

If you are using Proguard, please add following commands to the 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.**

4. MainApplication.javalink

Add the following code to the import section of the app/src/main/java/.../MainApplication.java

import io.airbridge.*;

Add the following code to the onCreate section of the app/src/main/java/.../MainApplication.java

@Override
public void onCreate() {
super.onCreate();
...
AirBridge.init(this, "[AppName]", "[AppToken]");
}

You can find the "App Name" in Airbridge dashboard's 'App Setting > App Info'
And you can find the "App Token" in Airbridge dashboard's 'App Setting > Tokens Management'

Register your app's information in Airbridge dashboard to use the deeplink feature.
Access the dashboard and click the Deeplinks menu in the sidebar. The following screen will appear afterwards.

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

AndroidManifest.xmllink

  1. Open app/src/main/AndroidManifest.xml file.
  2. Insert the following to the intent-filter of Activity, which opens with a deeplink.
<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>

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

Please enter the following code in the onResume section of Activity that opens with a deeplink.

@Override
protected void onResume() {
super.onResume();
AirBridge.getDeeplink().fetch(getIntent())
.onSuccess((deeplink) -> {
// when deeplink exist
Log.d("deeplink", "success : " + deeplink);
})
.onComplete(() -> {
// when deeplink exist
// when deeplink not exist
// when there are no error
Log.d("deeplink", "complete");
})
.onError((error) -> {
// when there are error
Log.d("deeplink", "error : " + error.getMessage());
});
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}

If the app is opened with a deeplink, onSuccess and onComplete function is called.
If the app is opened without a deeplink, only onComplete function is called.
If the app is opened with a deeplink, but error occurs, onError function is called.

If you have set up a custom domain of tracking link, set it as follows.

  1. Create file res/values/airbridge.xml
  2. Add the following values.
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ExtraTranslation" >
<string-array name="co_ab180_airbridge_trackinglink_customDomains">
<item>example.com</item>
</string-array>
</resources>

Insert the custom domain you set to example.com section.

You can change the shape of the deeplink that occurs on the onSuccess.

  1. Create file res/values/airbridge.xml
  2. Add the following values.
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ExtraTranslation" >
...
<string name="co_ab180_airbridge_deeplink_scheme">
example
</string>
<string name="co_ab180_airbridge_deeplink_host">
example.com
</string>
</resources>

If set as above, deeplink of onSuccess turn
https://appname.airbridge.io/... into
example://example.com/...

Deepink - Custom Domain and Tracking Link - Custom Domain must not be the same.

Verify Installation Completionlink

  1. Delete the app from the test device.
  2. Reinstall the app and run it on the satest device.
  3. Airbridge Dashboard → App choose → Log Data → Click the Realtime Log button.
  4. Enter Android GAID into 'Device UUID input'
  • If the data does not show up in real-time logs, please check again that the SDK is installed as directed in the installation section.
  • Log impressions can be delayed by up to 5 minutes.
  • Android GAID can be found Settings -> Google Settings -> Ads -> Your advertising ID

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.

In-App Event - userlink

User in-app events are a component of cross-platform user matching
Please include at least one user information if possible.

When a sign up and sign in event occurs,

All events are recorded as being triggered from that user until a sign-out event occurs.

If a sign out event occurs,
All events until the next sign-in event are recorded without that user-related data.

Email and phone user information is by default transmitted in a hashed format (SHA256).

Sign Uplink

If the user is signing up, send SignUpEvent.

Constructorlink

NameParameterDescription
SignUpEvent-Empty user signup event

Methodlink

NameParameterDescription
setUserIdString userId
User's ID
Set the user's ID
setUserEmailString userEmail
User's Email
Set the user's Email
setUserPhoneString userPhone
User's Phone
Set the user's Phone

Code Examplelink

SignUpEvent event = new SignUpEvent()
.setUserId("test-user-id")
.setUserEmail("test-email@foo.com")
.setUserPhoneNumber("000-0000-0000");
AirBridge.getTracker().sendEvent(event);

Sign Inlink

If the user is signing in, send SignInEvent.

Constructorlink

NameParameterDescription
SignInEvent-Empty user signin event

Methodlink

NameParameterDescription
setUserIdString userId
User's ID
Set the user's ID
setUserEmailString userEmail
User's Email
Set the user's Email
setUserPhoneString userPhone
User's Phone
Set the user's Phone

Code Examplelink

SignInEvent event = new SignInEvent()
.setUserId("test-user-id")
.setUserEmail("test-email@foo.com");
.setUserPhoneNumber("000-0000-0000");
AirBridge.getTracker().sendEvent(event);

Sign Outlink

If the user logs out, send SignOutEvent.

Constructorlink

NameParameterDescription
SignOutEvent-Empty user signout event

Code Examplelink

SignOutEvent event = new SignOutEvent()
AirBridge.getTracker().sendEvent(event);

In-App Event - commercelink

Tracks the user's commerce-related behavior.

Product classlink

This is about product class

Constructorlink

NameParameterDescription
Product-Empty product

Methodlink

NameParameterDescription
setProductIdString productId
Unique ID of the product
Set a unique ID for a product
setNameString name
Name of the product
Set product name
setCurrencyString currency
Currency ot the product
Set product currency
Complies with ISO 4217 standard
setPriceInteger price
Price of product
Set product price
setQuantityInteger quantity
Quantity of product
Set product quantity
setPositionInListInteger positionInList
Position of items in list
Set position of items in list

Code Examplelink

Product product = new Product();
product.setProductId("product_id_100600");
product.setName("Apple MacBook Pro");
product.setPrice(2160000);
product.setCurrency("KRW");
product.setQuantity(2);
product.setPositionInList(0);

HomeView Eventlink

If the user navigates to the app's home screen, please send HomeViewEvent.

Constructorlink

NameParameterDescription
HomeViewEvent-When user navigates to the app's home screen

Code Examplelink

HomeViewEvent event = new HomeViewEvent();
AirBridge.getTracker().sendEvent(event);

ProductList Eventlink

When a user queries the product list, please send ProductListViewEvent.

Constructorlink

NameParameterDescription
ProductListViewEvent-Empty product list inquiry event
ProductListViewEventString listId
Unique ID of Product List
List<Product> products
Product List
Events with IDs and lists of product listing
ProductListViewEventString listId
Unique ID of Product List
Product product
Product
Events with IDs and lists of product listings

Methodlink

NameParameterDescription
setListIdString listId
Unique ID of Product List
addProductProduct product
Product
Add product to the product list
addProductsList<Product> products
Product List
Add item list to product list

Code Examplelink

// Create product information
Product product1 = new Product();
product1.setProductId("product_id_100600");
product1.setName("Apple MacBook Pro");
product1.setPrice(2160000);
product1.setPositionInList(1);
Product product2 = new Product();
product2.setProductId("product_id_100800");
product2.setName("Samsung Notebook5");
product2.setPrice(1420000);
product2.setPositionInList(2);
// Create product list
List<Product> products = Arrays.asList(product1, product2);
// Create ProductListViewEvent
ProductListViewEvent event = new ProductListViewEvent("list_id_200400", products);
// Send event
AirBridge.getTracker().sendEvent(event);
  • If the user scrolls through the list and loads new information
    It is recommended that you separately generate and send the event with the loaded product information.

SearchResult Eventlink

If the user is searching for a product, please send SearchResultViewEvent.

Constructorlink

NameParameterDescription
SearchResultViewEvent-Empty search results event
SearchResultViewEventString query
Search word
List<Product> products
Search result list
Search results with search queries and product listings
SearchResultViewEventString query
Search word
Product product
Search result list
Search results with search terms and product

Methodlink

NameParameterDescription
setQueryString query
Search word
Set query information
addProductProduct
Product
Add product as a result of search
addProductsList<Product>
Product List
Add product list as search result

Code Examplelink

SearchResultViewEvent event = new SearchResultViewEvent ("24inch monitor", products);
AirBridge.getTracker().sendEvent(event);

Product Detail eventlink

If the user views more product details, please send ProductDetailsViewEvent.

Constructorlink

NameParameterDescription
ProductDetailsViewEvent-Empty product detail page inquiry Event
ProductDetailsViewEventList<Product>
Product List
Product detail page view for multiple products Event
ProductDetailsViewEventProduct
Product
Product detail page view event for single item

Code Examplelink

ProductDetailsViewEvent event = new ProductDetailsViewEvent(product);
AirBridge.getTracker().sendEvent(event);

Add to Cart Eventlink

If the user is adding items into their shopping cart, please send AddedToCartEvent.

Constructorlink

NameParameterDescription
AddedToCartEvent-Add to cart
AddedToCartEventString cartId
Unique ID of the cart
List<Product> products
Product List
AddedToCartEvent contains cartId and product list
AddedToCartEventString cartId
Unique ID of the cart
Product product
Product
AddedToCartEvent contains cartId and product list

Methodlink

NameParameterDescription
setCartIdString cartId
Unique ID of the cart
Set Unique ID of the cart
addProductProduct
Product
Add item to the cart
addProductsList<Product> products
Product List
Add item list to the cart
setCurrencyStringSet product currency
Complies with ISO 4217 standard
setTotalValueFloatSet the total amount of items to add to your cart

Code Examplelink

Product product1 = new Product();
product1.setProductId("product_id_100600");
product1.setName("Apple MacBook Pro");
product1.setPrice(2160000);
product1.setPositionInList(1);
Product product2 = new Product();
product2.setProductId("product_id_100800");
product2.setName("Samsung Notebook5");
product2.setPrice(1420000);
product2.setPositionInList(2);
List<Product> products = Arrays.asList(product1, product2);
AddedToCartEvent event = new AddedToCartEvent()
.setCartId("cart_id_51243")
.addProducts(products)
.setCurrency("KRW")
.setTotalValue(3580000);
AirBridge.getTracker().sendEvent(event);

Purchase Eventlink

If the user pays, please send PurchaseEvent.

Constructorlink

NameParameterDescription
PurchaseEvent-Purchase event
PurchaseEventList<Product> products
Product List
Payment events for multiple product
PurchaseEventProduct product
Product
Payment events for single product

Methodlink

NameParameterDescription
addProductProduct product
Product
Add paid product
addProductsList<Product> product
Product List
Add paid products
setInAppPurchaseBoolean isInAppPurchase
In-app payments
Set in-app payments
setTotalValueFloat totalValue
Total payment amount
Set total payment amount
setTransactionIdString transactionId
Unique ID of payment
Set unique ID of payment
setCurrencyString currency
Currency ot the product
Set product currency
Complies with ISO 4217 standard

Code Examplelink

Product product1 = new Product();
product1.setProductId("product_id_100600");
product1.setName("Apple MacBook Pro");
product1.setPrice(2160000);
product1.setPositionInList(1);
Product product2 = new Product();
product2.setProductId("product_id_100800");
product2.setName("Samsung Notebook5");
product2.setPrice(1420000);
product2.setPositionInList(2);
List<Product> products = Arrays.asList(product1, product2);
PurchaseEvent event = new PurchaseEvent(products)
.setTransactionId("transact-purchase-01")
.setInAppPurchaseed(true)
.setCurrency("KRW")
.setTotalValue(3580000);
AirBridge.getTracker().sendEvent(event);

In-App Event - customlink

In-app events can be customly defined and used.

Constructorlink

NameParameterDescription
GoalEventString category
Event Name
Custom events that contain category

Methodlink

NameParameterDescription
setCategoryStringEvent Name
setActionStringEvent action value
setLabelStringEvent label value
setValueIntegerEvent custom value
setCustomAttributeString, Object Event custom information

Code Examplelink

GoalEvent event = new GoalEvent("category")
.setAction("action")
.setLabel("label")
.setValue(3412);
AirBridge.getTracker().sendEvent(event);

For more information on Category, Action, Labels, see Classification In-App event part.

Additional Collectionlink

You can gather more additional information.

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

// if AirBridge.init() is not called, call on MainApplication#onCreate
AirBridge.initPlacement();
AirBridge.getPlacement().click("https://abr.ge/~~~", "ablog://main", "https://airbridge.io");
AirBridge.getPlacement().impression("https://abr.ge/~~~");

If AirBridge.init() is called, you do not need to call AirBridge.initPlacement().
If you have not called AirBridge.init() please call AirBridge.initPlacement().

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

Installed app listslink

You can collect the list of installed apps on your customer's device.

AirBridge.setInstalledAppEnable(true); // Installed app lists option On
Airbridge.init();
AirBridge.setInstalledAppEnable(false); // Installed app lists option Off
Airbridge.init();

The default value for the list of installed apps in the Airbridge Android SDK is false.

User carrier name collectionlink

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

Add the following permissions to the 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.

Settingslink

Session durationlink

You can set the session duration for your app by calling the following method:

The duration of the session is in seconds and must be greater than 0 and less than or equal to 604800 (7 days).

AirBridge.setCustomSessionTimeOut(300);
Airbridge.init();

The session duration is by default 300 seconds (5 minutes).

Disable hashing of user informationlink

The user's email and phone information is by default transmitted in a hashed format (SHA256).

If you do not want to hash the information, you can change the setting using the following method.

// Unhash User Information
AirBridge.getTracker().setIsUserInfoHashed(false);
// Hash User Information
Airbridge.getTracker().setIsUserInfoHashed(true);

Classification In-App eventlink

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

Category is the name of the event.
Action is subclass 1 of the event.
Label is subclass 2 of the event.

All in-app events can modify actions and labels.
Custom in-app events category can be changed but default in-app events category cannot be changed.

Code Examplelink

SignUpEvent signUpEvent1 = new SignUpEvent()
.setAction("Seoul")
.setLabel("30s");
SignUpEvent signUpEvent2 = new SignUpEvent()
.setAction("Seoul")
.setLabel("40s");
SignUpEvent signUpEvent3 = new SignUpEvent()
.setAction("Busan")
.setLabel("30s");
PurchaseEvent purchaseEvent1 = new PurchaseEvent()
.setAction("product A")
.setLabel("option B");
PurchaseEvent purchaseEvent2 = new PurchaseEvent()
.setAction("product A")
.setLabel("option C");
GoalEvent subscribeEvent1 = new GoalEvent("subscribe")
.setAction("normal");
GoalEvent subscribeEvent2 = new GoalEvent("subscribe")
.setAction("preminum");
for(int i=0; i<10; i++) {
AirBridge.getTracker().sendEvent(signUpEvent1);
}
for(int i=0; i<20; i++) {
AirBridge.getTracker().sendEvent(signUpEvent2);
}
for(int i=0; i<15; i++) {
AirBridge.getTracker().sendEvent(signUpEvent3);
}
for(int i=0; i<8; i++) {
AirBridge.getTracker().sendEvent(purchaseEvent1);
}
for(int i=0; i<7; i++) {
AirBridge.getTracker().sendEvent(purchaseEvent2);
}
for(int i=0; i<10; i++) {
AirBridge.getTracker().sendEvent(subscribeEvent1);
}
for(int i=0; i<5; i++) {
AirBridge.getTracker().sendEvent(subscribeEvent2);
}

You can view each event statistic by Category in the Airbridge dashboard.
You can also see statistics separated by Action and Category.

As a result, you can view the following results on the dash board.

CategoryActionLabelCount
Sign upSeoul30s10
Sign upSeoul40s20
Sign upBusan30s15
Paymentsproduct Aoption B8
Paymentsproduct Aoption C7
Subscribenormal10
Subscribepremium5

Log Monitoringlink

If you need to check the debugging log, add the following code to the onCreate method of your application's Application class:

AirBridge.setDebugMode(true);

Advanced - Web Applink

When Web App case, You can send in-app events as follows.

Send event from native (option 1)link

On web, when android app, call native function and call Airbridge Android SDK to send Mobile Event.
On web, when browser, call Airbridge Web SDK to send Web Event.

Example code - Javascriptlink

if (check Android app) {
// When android app, send event with Airbridge Android SDK
AirbridgeNative.goal('category')
} else {
// When browser, send event with Airbridge Web SDK
airbridge.events.send('category', {});
}

Example code - JavascriptInterfacelink

public class AirbridgeInterface {
@JavascriptInterface
public void goal(String category) {
GoalEvent event = new GoalEvent(category);
AirBridge.getTracker().sendEvent(event);
}
}
...
webView.addJavascriptInterface(new AirbridgeInterface(), "AirbridgeNative");

Send event from web (option 2)link

On web, when android app, init Airbridge Android SDK with mobileApp to send Mobile Event.
On web, when browser, init Airbridge Web SDK to send Web Event.

Example code - Javascriptlink

(function(a_,i_,r_,_b,_r,_i,_d,_g,_e){if(!a_[_b]||!a_[_b].queue){_g=i_.getElementsByTagName(r_)[0];a_[_b]={queue:[]};_d={};for(_i=0;_i<_r.length;_d={$jscomp$loop$prop$m$2:_d.$jscomp$loop$prop$m$2},_i++)_d.$jscomp$loop$prop$m$2=_r[_i],~_d.$jscomp$loop$prop$m$2.indexOf(".")&&(_e=_d.$jscomp$loop$prop$m$2.split(".")[0],a_[_b][_e]=a_[_b][_e]||{},a_[_b][_e][_d.$jscomp$loop$prop$m$2.split(".")[1]]=function(_d){return function(){a_[_b].queue.push([_d.$jscomp$loop$prop$m$2,arguments])}}(_d)),a_[_b][_d.$jscomp$loop$prop$m$2]=function(_d){return function(){a_[_b].queue.push([_d.$jscomp$loop$prop$m$2,arguments])}}(_d);_d=i_.createElement(r_);_d.async=1;_d.src="//static.airbridge.io/sdk/latest/airbridge.min.js";_g.parentNode.insertBefore(_d,_g)}})(window,document,"script","airbridge","init setBanner setDownload setDeeplinks sendSMS sendWeb setUserAgent setUserAlias addUserAlias setMobileAppData setUserId setUserEmail setUserPhone setUserAttributes setDeviceIFV setDeviceIFA setDeviceGAID events.send events.signIn events.signUp events.signOut events.purchased events.addedToCart events.productDetailsViewEvent events.homeViewEvent events.productListViewEvent events.searchResultViewEvent".split(" "));
var deviceUUID = undefined;
var packageName = undefined;
var isLimitAdTracking = undefined;
var appVersion = undefined;
try {
deviceUUID = window.AirbridgeDeviceInfo.getDeviceUUID();
packageName = window.AirbridgeDeviceInfo.getPackageName();
isLimitAdTracking = window.AirbridgeDeviceInfo.isLimitAdTracking();
appVersion = window.AirbridgeDeviceInfo.getAppVersion();
} catch {}
if (typeof deviceUUID === 'string'
&& typeof packageName === 'string'
&& typeof isLimitAdTracking === 'boolean'
&& typeof appVersion === 'string')
{
// when android app
airbridge.init({
app: 'ablog',
webToken: '8ec37a00b37a4576a7f8bdf8d5164dd5',
mobileApp: {
deviceUUID: deviceUUID,
packageName: packageName,
limitAdTracking: isLimitAdTracking,
appVersion: appVersion,
}
});
} else {
// when browser
airbridge.init({
app: 'ablog',
webToken: '8ec37a00b37a4576a7f8bdf8d5164dd5'
});
}
// when android app, send web event
// when browser, send mobile event
airbridge.events.send('category', {
'label': 'label',
'action': 'action',
'value': 123.0,
'customAttributes': {
'custom1': 123,
'custom2': 'abc'
}
});

Example code - Activitylink

public class MainActivity extends Activity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fetchDeviceInfo((deviceInfo) -> runOnUiThread(() -> startWebView(deviceInfo)));
}
void startWebView(DeviceInfo deviceInfo) {
webView = findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.addJavascriptInterface(new DeviceInfoInterface(deviceInfo), "AirbridgeDeviceInfo");
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("http://dev.blog.airbridge.io/websdk-web-app/");
}
class DeviceInfoInterface {
DeviceInfo deviceInfo;
public DeviceInfoInterface(DeviceInfo deviceInfo) {
this.deviceInfo = deviceInfo;
}
@JavascriptInterface
public String getDeviceUUID() {
return deviceInfo.uuid;
}
@JavascriptInterface
public String getPackageName() {
return deviceInfo.packageName;
}
@JavascriptInterface
public boolean isLimitAdTracking() {
return deviceInfo.isLAT;
}
@JavascriptInterface
public String getAppVersion() {
return deviceInfo.appVersion;
}
}
void fetchDeviceInfo(DeviceInfoFetchListener listener) {
PackageInfo info = context.getPackageManager.getPackageInfo(context.packageName, 0);
String packageName = getApplicationContext().getPackageName();
String appVersion = info.versionName;
AtomicReference<String> uuid = new AtomicReference<>(null);
AtomicReference<Boolean> isLAT = new AtomicReference<>(null);
final Thread thread = new Thread(() -> {
try { Thread.sleep(3000); }
catch (InterruptedException ignored) {}
if (uuid.get() != null && isLAT.get() != null) {
listener.onFetched(new DeviceInfo(packageName, appVersion, uuid.get(), isLAT.get()));
}
});
thread.start();
AirBridge.getDeviceUUID(input -> {
uuid.set(input);
if (uuid.get() != null && isLAT.get() != null) {
thread.interrupt();
}
});
AirBridge.isLimitADTracking(input -> {
isLAT.set(input);
if (uuid.get() != null && isLAT.get() != null) {
thread.interrupt();
}
});
}
interface DeviceInfoFetchListener {
void onFetched(DeviceInfo deviceInfo);
}
class DeviceInfo {
String packageName;
String uuid;
Boolean isLAT;
String appVersion;
public DeviceInfo(String packageName, String appVersion, String uuid, Boolean isLAT) {
this.packageName = packageName;
this.uuid = uuid;
this.isLAT = isLAT;
this.appVersion = appVersion
}
}
}

Advancedlink

SDK Direct Installlink

Airbridge SDKlink

sdk-android-1.7.5.aar : Download

Download the SDK file and apply it to your project.

Google Play Installreferrer Librarylink

installreferrer-1.0.aar : Download

Download the Google Play Installreferrer library and apply it to your project.

The license for the Google Play Installreferrer Library is Apache 2.0

Setting user information manuallylink

In addition to triggering an event, you can set user information manually.

If you apply it in the following way, all events will be recorded as being triggered by that user.

AirBridge.getTracker().setUserID("testID");
AirBridge.getTracker().setUserEmail("testID@ab180.co");
AirBridge.getTracker().setUserPhone("000-0000-0000");
AirBridge.getTracker().setUserAlias("key", "value");
AirBridge.getTracker().addUserAttribute("key", "value");

The number of User Attribute size is up to 100
User Attribute key length is up to 128
User Attribute key should satisfy ^[a-z][a-z0-9_]*$ regular expression
User Attribute value should be primitive type If User Attribute value is string, the value length is 1024

The number of User Alias is up to 10.
User Alias key length is up to 128.
User Alias value length is up to 128.
The User Alias key must satisfy the regular expression ^[a-z_][a-z0-9_]*$.

User alias and attributes information are not change when 'SignInEvent' and 'SignUpEvent' events occur.
User alias and attributes information will remove when the 'SignOutEvent' event occurred.

Manual setting for device informationlink

Enter additional device information.

HashMap<String, String> deviceAlias = new HashMap<String, String>();
deviceAlias.put("key", "value");
AirBridge.getTracker().setDeviceAlias(deviceAlias);
AirBridge.getTracker().addUserAlias("key", "value");

Maximum count of Device-Alias is 10.
Maximum length of Device-Alias's key is 128.
Maximum length of Device-Alias's value is 128.
Device-Alias's key must meet [a-z_][a-z0-9_]* condition.

In-App Event Occurred in WebViewlink

If you use WebView, you can send in-app events through Webview's Javascript Interface function.

public class MyWebAppInterface {
Context mContext;
MyWebAppInterface(Context context) {
mContext = context;
}
/**
* Sends goal event.
*/
@JavascriptInterface
public void goal(int value) {
// TODO: Send event what you want
GoalEvent event = new GoalEvent("my-category")
.setAction(“my-action”);
.setValue(value);
AirBridge.getTracker().sendEvent(event);
}
}
...
webView.addJavascriptInterface(new MyWebAppInterface(this), "myAndroid");

The Javascript Interface allows you to call methods from your web app.

myAndroid.goal(1234);

Using another referrer tracking toollink

Register the third party receiver with the name you want in the io.airbridge.DeferredLinkReceiver entry in the app/src/main/AndroidManifest.xml file.

<receiver android:name="io.airbridge.DeferredLinkReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
<!-- For GA Campaign Receiver -->
<meta-data android:name="GAReceiver" android:value="com.google.android.gms.analytics.CampaignTrackingReceiver"/>
<!-- For Custom Receiver -->
<meta-data android:name="CustomReceiver1" android:value="io.airbridge.test.TPReceiver"/>
</receiver>

Exclude certain screens from trackinglink

Normally, Airbridge automatically tracks activities for statistical analytics. But some non-generic activities can bring unintended statistical results.

For example, if the app offers a lock screen function, Airbridge will count user unlocks as an event action.
To prevent such unintended statistical reporting, you can mark these activities with an annotation @DontTrack to make exceptions.

@DontTrack
class LockscreenActivity extends Activity { ... }

Support Android 4.0 (API 14) or lowerlink

Airbridge SDK automatically tracks app life cycles for installs and performance statistics.
However, for Android 4.0 (API Level 14) or lower, automatic tracking is not possible, preventing accurate tracking.
In such case, manual tracking is required to collect statistics.

To Turn Off Tracking on Automatic Life Cyclelink

Before calling AirBridge.init (initializing Airbridge), please call the following method to turn off an automatic tracking.

PageTracker.disableAutoLifecycleTracking();
AirBridge.init(this, ...);

To Manually Call Life Cycle Handler in Activitylink

When handler is called manually in Base Activity, where all of in-app activities are inherited,
tracking is enabled to measure life cycles of in-app activities.

class BaseActivity extends Activity {
@Override
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
AirBridge.getLifecycleTracker().onActivityCreated(this, savedState);
}
@Override
public void onResume() {
super.onResume();
AirBridge.getLifecycleTracker().onActivityResumed(this);
}
@Override
public void onDestroy() {
super.onDestroy();
AirBridge.getLifecycleTracker().onActivityDestroyed(this);
}
}

Get UUID informationlink

Gets the DeviceUUID.link

AirBridge.getDeviceUUID(new AirBridge.UUIDCallback() {
@Override
public void done(String uuid) {
}
});

Gets whether ADID is allowedlink

AirBridge.isLimitADTracking(new AirBridge.ADIDCallback() {
@Override
public void done(Boolean isLAT) {
}
});

Stop tracking (Opt-out)link

You can stop sending events from the SDK.

AirBridge.setLimitUserTracking(true);

true : Stop tracking
false : Tracking

SDK migrationlink

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

before 1.6.14link

Please call the DeepLink.registerDeepLinkCallback function before calling the AirBridge.init function.

DeepLink.registerDeferredLinkCallback(new DeepLink.Callback() {
@Override
public void TrackingLinkResponse(String URL, HashMap<String, String> param) {
// do what you want to do
}
});
AirBridge.init();

Please call the DeepLink.registerDeepLinkCallback function before calling the AirBridge.init function.

DeepLink.registerDeepLinkCallback(new DeepLink.Callback() {
@Override
public void TrackingLinkResponse(String URL, HashMap<String, String> param) {
// do what you want to do
}
});
AirBridge.init();