# AlgoriX SDK Integration
# Step 1: Import SDK
# AAR/JAR library file integration
Copy the alx...*.aar from the SDK compression package to the Application Module/libs folder. If this folder doesn’t exist, please create one manually. Then, add the following codes to build.gradle in your Module app:
//In Unity, the application folder is exported as unityLibrary
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name: 'alx.*.*.*', ext: 'aar') //replace with the specific sdk version number
}
2
3
4
5
6
7
8
9
10
# Step 2: Global Setting
# Permission Configuration
It’s recommended to configure the following permissions and announce in your privacy policy that Alx SDK is allowed to get access to these permissions.
<!—Required Permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!—Optional Permission -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
2
3
4
5
6
7
# Environment Configuration
The SDK can support Android 4.0 (API Level 14) and higher.
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29" />
If developers use targetSdkVersion API 23 and higher, ensure all permissions are added to the SDK before calling any API interfaces. Otherwise, certain features might not work.
# ProGuard Configuration
Add the following codes to the .pro file under the APP folder (For Android, the file is usually exported as proguard-rules.pro. For Unity, the file is exported as proguard-unity.txt):
- keep class
com.alxad.** {*;}
- keep class
admob.custom.adapter.** {*;}
- keep class
anythink.custom.adapter.** {*;}
# Step 3: Integration
First, please ask your account manager to create an SDK account on the AlgoriX dashboard and provide you with the login information.
Then, create your app and placement on the AlgoriX dashboard, and get your Token, SID (ID on the AlgoriX dashboard), APP_ID and Unit ID (Placement ID on the AlgoriX dashboard) as shown below.
Initialize the ALX SDK in your app by calling Application#onCreate().
The account-related information (Token, SID, APP_ID) can be retrieved from the AlgoriX dashboard. You can also contact your account manager for the information.
AlxAdSDK.init(this, AppConfig.ALX_TOKEN, AppConfig.ALX_SID, AppConfig.ALX_APP_ID, new AlxSdkInitCallback() {
@Override
public void onInit(boolean isOk, String msg) {
}
});
2
3
4
5
6
# Banner
Banner ads occupy a space within an app's layout, either at the top or bottom of the device screen. Banner ads stay on the screen while users are interacting with the app. Banner ads can refresh automatically after a certain period of time.
- Integration Code:
Add AlxBannerAd to the layout: The first step towards displaying a banner ad is to place AlxBannerAd in the layout for the Activity or Fragment in which you'd like to display it. The easiest way to do this is to add AlxBannerAd to the corresponding XML layout file. Our SDK also provides the function to preload the banner ads.
Here's an example that shows an activity's AlxBannerAd:
<com.alxad.api.AlxBannerAD
android:id="@+id/alx_ad_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true">
</com.alxad.api.AlxBannerAD>
2
3
4
5
6
7
If you need to preload the banner ads, you can create a FrameLayout like below:
<FrameLayout
android:id="@+id/ad_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp" />
2
3
4
5
6
Here's an example that shows how to load a banner ad within the onCreate() method of an Activity:
public class AlxBannerDemoActivity extends AppCompatActivity implements
View.OnClickListener {
private final String TAG = "AlxBannerDemoActivity";
private AlxBannerAD alxBannerAD;
// private TextView mTvTitle;
private Button mBnLoad;
private Button mBnShow;
private TextView mTvTip;
private Button mBnLoadAndShow;
private int adSize;
private FrameLayout mAdContainer;
private AlxBannerAD mAlxBannerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alx_banner_demo);
if (getIntent() != null) {
adSize = getIntent().getIntExtra("adsize", 0);
}
AlxBannerAD.AlxAdSize alxAdSize = adSize == 0 ? AlxBannerAD.AlxAdSize.SIZE_320_50 :
adSize == 1 ? AlxBannerAD.AlxAdSize.SIZE_300_250 :
AlxBannerAD.AlxAdSize.SIZE_320_480;
Log.d(TAG, "adsize : " + alxAdSize);
setTitle("BannerAd w_h: " + alxAdSize);
mTvTip = (TextView) findViewById(R.id.tv_tip);
mBnLoad = (Button) findViewById(R.id.bn_load);
mBnShow = (Button) findViewById(R.id.bn_show);
mBnLoadAndShow = (Button) findViewById(R.id.bn_load_show);
mAdContainer = (FrameLayout) findViewById(R.id.ad_container);
mAlxBannerView = (AlxBannerAD) findViewById(R.id.alx_ad_banner);
mBnLoad.setOnClickListener(this);
mBnShow.setOnClickListener(this);
mBnLoadAndShow.setOnClickListener(this);
mBnShow.setEnabled(false);
}
@Override
protected void onDestroy() {
if (alxBannerAD != null) {
alxBannerAD.destory();
}
if (mAlxBannerView != null) {
mAlxBannerView.destory();
}
super.onDestroy();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bn_load:
bnPreLoad();//Preload
break;
case R.id.bn_show:
bnShow();//Display banner
break;
case R.id.bn_load_show:
bnLoadAndShow();//Load and show
break;
}
}
private void bnPreLoad() {
mBnLoad.setEnabled(false);
alxBannerAD = new AlxBannerAD(this);
AlxBannerAD.AlxAdSize alxAdSize = adSize == 0 ? AlxBannerAD.AlxAdSize.SIZE_320_50 :
adSize == 1 ? AlxBannerAD.AlxAdSize.SIZE_300_250 :
AlxBannerAD.AlxAdSize.SIZE_320_480;
alxBannerAD.setCanClosed(false);
alxBannerAD.preLoad(this,AppConfig.ALX_BANNER_AD_PID, new AlxBannerADListener() {
@Override
public void onAdLoaded(AlxBannerAD banner) {
Log.d(TAG, "onAdLoaded:" + Thread.currentThread().getName());
mTvTip.setText("AlxBannerAD");
mBnShow.setEnabled(true);
mBnLoad.setEnabled(true);
}
@Override
public void onAdError(AlxBannerAD banner, int errorCode, String errorMsg) {
mBnShow.setEnabled(false);
mBnLoad.setEnabled(true);
mTvTip.setText("AlxBannerAD ");
Log.d(TAG, "onAdError errorMsg:" + errorMsg + " errorCode:" + errorCode + ":" + Thread.currentThread().getName());
}
@Override
public void onAdClicked(AlxBannerAD banner) {
Log.d(TAG, "onAdClicked ");
}
@Override
public void onAdShow(AlxBannerAD banner) {
Log.d(TAG, "onAdShow ");
}
@Override
public void onAdClose() {
Log.d(TAG, "onAdClose");
}
}, alxAdSize);
}
private void bnShow() {
if (alxBannerAD != null && alxBannerAD.isReady()) {
alxBannerAD.showAd(mAdContainer);
mTvTip.setText("");
}
}
private void bnLoadAndShow() {
AlxBannerAD.AlxAdSize alxAdSize = adSize == 0 ? AlxBannerAD.AlxAdSize.SIZE_320_50 :
adSize == 1 ? AlxBannerAD.AlxAdSize.SIZE_300_250 :
AlxBannerAD.AlxAdSize.SIZE_320_480;
mAlxBannerView.setVisibility(View.VISIBLE);
mAlxBannerView.setCanClosed(true);
mAlxBannerView.load(this,AppConfig.ALX_BANNER_AD_PID, new AlxBannerADListener() {
@Override
public void onAdLoaded(AlxBannerAD banner) {
Log.d(TAG, "onAdLoaded ");
}
@Override
public void onAdError(AlxBannerAD banner, int errorCode, String errorMsg) {
Log.d(TAG, "onAdError errorMsg:" + errorMsg + " errorCode:" + errorCode);
}
@Override
public void onAdClicked(AlxBannerAD banner) {
Log.d(TAG, "onAdClicked");
}
@Override
public void onAdShow(AlxBannerAD banner) {
Log.d(TAG, "onAdShow");
}
@Override
public void onAdClose() {
Log.d(TAG, "onAdClose");
}
}, alxAdSize);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Here’s an example for Unity:
public class AlxBannerJavaDemoActivity extends AppCompatActivity {
FrameLayout frameLayout;
AlxBannerAD alxBannerAD;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
frameLayout = new FrameLayout(this);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL;
frameLayout.setLayoutParams(layoutParams);
setContentView(frameLayout);
alxBannerAD = new AlxBannerAD(this);
alxBannerAD.load(this,AppConfig.ALX_BANNER_AD_PID,new AlxBannerADListener() {
@Override
public void onAdLoaded(AlxBannerAD banner) {
}
@Override
public void onAdError(AlxBannerAD banner, int errorCode, String errorMsg) {
}
@Override
public void onAdClicked(AlxBannerAD banner) {
}
@Override
public void onAdShow(AlxBannerAD banner) {
}
}, AlxBannerAD.AlxAdSize.SIZE_320_50);
frameLayout.addView(alxBannerAD);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Rewarded Video
OnReward() will be called back when the reward is issued. Developers can send a reward to users in the onReward() callback.
Integration suggestions:
- Call the load method in advance (As soon as your app is launched) to trigger the ad request so that an ad response can be ready when it needs to be displayed in your app.
- In the onRewardedVideoAdClosed callback, it is recommended to call the load method to trigger a new ad request to facilitate the next ad display.
- Do not call the load method all the time in the onRewardedVideoAdFailed callback, it may cause the application to jam.
Code flow suggestions:
- Start the app or game with AlxRewardVideoAd.load to load ads.
- When the Rewarded video needs to be displayed, check whether the ad is ready to display using AlxRewardVideoAd.isReady.
a. If AlxRewardVideoAd.isReady is FALSE, re-execute AlxRewardVideoAd.load to trigger another ad request.
b. If AlxRewardVideoAd.isReady is TRUE, execute AlxRewardVideoAd.show to display the ad, then execute AlxRewardVideoAd.load in the callback of onRewardedVideoAdClosed to preload the next ad. - In the onRewardedVideoAdClosed callback, you can directly call load without checking AlxRewardVideoAd.isReady, which helps to increase the chance of impressions for high demand campaigns.
- Integration Code:
//Create a RewardVideo object
AlxRewardVideoAD alxRewardVideoAD = new AlxRewardVideoAD();
// Load rewarded video ads
alxRewardVideoAD.load(this, mPid , new AlxRewardVideoADListener() { //mPid AlgoriX placement id
@Override
public void onRewardedVideoAdLoaded(AlxRewardVideoAD var1) {
Log.i(TAG, "onRewardedVideoAdLoaded :" );
showVideo(); //Show rewarded video ads
}
@Override
public void onRewardedVideoAdFailed(AlxRewardVideoAD var1, int errCode, String errMsg) {
Log.i(TAG, "onRewardedVideoAdFailed :" + errCode + " " + errMsg);
}
@Override
public void onRewardedVideoAdPlayStart(AlxRewardVideoAD var1) {
Log.i(TAG, " onRewardedVideoAdPlayStart :");
}
@Override
public void onRewardedVideoAdPlayEnd(AlxRewardVideoAD var1) {
Log.i(TAG, " onRewardedVideoAdPlayEnd :");
}
@Override
public void onRewardedVideoAdPlayFailed(AlxRewardVideoAD var2, int errCode, String errMsg) {
Log.i(TAG, " onRewardedVideoAdPlayFailed:"+errCode+";"+errMsg);
}
@Override
public void onRewardedVideoAdClosed(AlxRewardVideoAD var1) {
Log.i(TAG, " onRewardedVideoAdClosed :");
}
@Override
public void onRewardedVideoAdPlayClicked(AlxRewardVideoAD var1) {
Log.i(TAG, " onRewardedVideoAdPlayClicked :");
}
@Override
public void onReward(AlxRewardVideoAD var1) {
Log.i(TAG, " onReward :");
}
});
public void showRewardVideo(){
if (alxRewardVideoAD.isLoaded()) {
alxRewardVideoAD.showVideo(this);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Interstitial
Interstitial ads are full-screen ads that cover the whole interface of the app.
Integration suggestions:
- Call the load method in advance (As soon as your app is launched) to trigger the ad request so that an ad response can be ready when it needs to be displayed in your app.
- In the onInterstitialAdClose callback, it is recommended to call the load method to trigger a new ad request to facilitate the next ad display.
- Do not call the load method all the time in the onInterstitialAdLoadFail callback, it may cause the application to jam.
Code flow suggestions:
- Start the app or game with AlxInterstitialAD.load to load ads
- When the Interstitial ad needs to be displayed, check whether the ad is ready to display using AlxInterstitialAD.isReady
a. If AlxInterstitialAD.isReady is FALSE, re-execute AlxInterstitialAD.load to trigger another ad request.
b. If AlxInterstitialAD.isReady is TRUE, execute AlxInterstitialAD.show to display the ad, and then execute AlxInterstitialAD.load in the callback of onInterstitialAdClose to preload the next ad.
- Integration Code:
//Create an AlxInterstitialAD object
AlxInterstitialAD alxInterstitialAD = new AlxInterstitialAD();
alxInterstitialAD.load(mContext, mPid, new AlxInterstitialADListener() { //mPid placement id
@Override
public void onInterstitialAdLoaded() {
Log.d(TAG, "onInterstitialAdLoaded success");
If(alxInterstitialAD.isReady();){
alxInterstitialAD.show(MainActivity.this);//show interstitial ads
}
@Override
public void onInterstitialAdLoadFail(int i, String s) {
Log.d(TAG, "onInterstitialAdLoadFail " + "errorCode: " + i + " errorMSg: " + s);
}
@Override
public void onInterstitialAdClicked() {
Log.d(TAG, "onInterstitialAdClicked");
}
@Override
public void onInterstitialAdShow() {
Log.d(TAG, "onInterstitialAdShow");
}
@Override
public void onInterstitialAdClose() {
Log.d(TAG, "onInterstitialAdClose");
}
@Override
public void onInterstitialAdVideoStart() {
}
@Override
public void onInterstitialAdVideoEnd() {
}
@Override
public void onInterstitialAdVideoError(int i, String s) {
Log.d(TAG, "onInterstitialAdVideoError " + "errorCode: " + i + " errorMSg: " + s);
}
});
});
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Native
Native in-feeds ads including images, text, or videos creative assets can be less disruptive and fit seamlessly into the surrounding content to match your app content layout. The layout can be customized for native ads as you want.
- Integration Code:
- Create AlxNativeAdLoader and trigger an ad request. Note: Please call this method in your main activity thread.
The sample code is as follows:
AlxNativeAdLoader loader = new AlxNativeAdLoader.Builder(this, "172943").build();
loader.loadAd(new AlxAdParam.Builder().build(), new AlxNativeAdLoadedListener() {
@Override
public void onAdFailed(int errorCode, String errorMsg) {
// Called when an ad fails to be loaded.
}
@Override
public void onAdLoaded(List<AlxNativeAd> ads) {
// Called when an ad is loaded successfully
}
});
2
3
4
5
6
7
8
9
10
11
12
- Display the native ad.
2.1 Customize a layout to display the creative assets of AlxNativeAd.
Note:
AlxNativeAdView must be used as the root layout of native ads. Otherwise, monetization revenue may be affected.
2
The following code is a sample view hierarchy for a native ad that uses RelativeLayout to display its creative assets:
<com.alxad.api.nativead.AlxNativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
... >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
... >
<!-- Multimedia view. -->
<com.alxad.api.nativead.AlxMediaView
android:id="@+id/ad_media"
android:layout_width="match_parent"
android:layout_height="wrap_content"
... />
<RelativeLayout
... >
<TextView
android:id="@+id/ad_title"
android:layout_width="match_parent"
android:layout_height="34dp"
... />
<!-- Other assets. -->
...
</RelativeLayout>
<!-- Other assets. -->
...
</RelativeLayout>
</com.alxad.api.nativead.AlxNativeAdView>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2.2 Register and populate the asset view.
After obtaining the AlxNativeAdView object, register and populate the asset view. Refer to the sample code below:
private void initNativeAdView(AlxNativeAd nativeAd,AlxNativeAdView nativeView) {
ImageView logo = (ImageView) nativeView.findViewById(R.id.ad_logo);
ImageView icon = (ImageView) nativeView.findViewById(R.id.ad_icon);
TextView title = (TextView) nativeView.findViewById(R.id.ad_title);
TextView description = (TextView) nativeView.findViewById(R.id.ad_desc);
TextView source = (TextView) nativeView.findViewById(R.id.ad_source);
Button callToAction = (Button) nativeView.findViewById(R.id.ad_call_to_action);
ImageView close = (ImageView) nativeView.findViewById(R.id.ad_close);
AlxMediaView mediaView = (AlxMediaView) nativeView.findViewById(R.id.ad_media);
// Register and populate the title view.
nativeView.setTitleView(title);
title.setText(nativeAd.getTitle());
// Register and populate the multimedia view.
nativeView.setMediaView(mediaView);
mediaView.setMediaContent(nativeAd.getMediaContent());
// Register and populate other asset views.
nativeView.setDescriptionView(description);
nativeView.setIconView(icon);
nativeView.setCallToActionView(callToAction);
nativeView.setCloseView(close);
nativeView.setAdSourceView(source);
description.setText(nativeAd.getDescription());
logo.setImageBitmap(nativeAd.getAdLogo());
if (TextUtils.isEmpty(nativeAd.getAdSource())) {
source.setVisibility(View.GONE);
} else {
source.setVisibility(View.VISIBLE);
source.setText(nativeAd.getAdSource());
}
if (TextUtils.isEmpty(nativeAd.getCallToAction())) {
callToAction.setVisibility(View.GONE);
} else {
callToAction.setVisibility(View.VISIBLE);
callToAction.setText(nativeAd.getCallToAction());
}
//Video ads listener
if (nativeAd.getMediaContent() != null && nativeAd.getMediaContent().hasVideo()) {
nativeAd.getMediaContent().setVideoLifecycleListener(new AlxMediaContent.VideoLifecycleListener() {
@Override
public void onVideoStart() {
}
@Override
public void onVideoEnd() {
}
@Override
public void onVideoPlay() {
}
@Override
public void onVideoPause() {
}
@Override
public void onVideoMute(boolean isMute) {
}
});
}
// Register the native ad object
nativeView.setNativeAd(nativeAd);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Register and populate the creative assets in sequence as shown in the sample code above. AlxMediaView is used to display multimedia assets. If the loaded native ad includes a video asset, the video will be rendered in AlxMediaView. Otherwise, an image will be rendered in AlxMediaView.
2.3 Register the native ad object with AlxNativeAdView.
Refer to the sample code below:
nativeView.setNativeAd(nativeAd);
2.4 Display AlxNativeAdView
Add AlxNativeAdView to the layout to display the native ad. Refer to the sample code below:
private void loadAd() {
AlxNativeAdLoader loader = new AlxNativeAdLoader.Builder(this, "172943").build();
loader.loadAd(new AlxAdParam.Builder().build(), new AlxNativeAdLoadedListener() {
@Override
public void onAdLoaded(List<AlxNativeAd> ads) {
……
AlxNativeAd nativeAd = ads.get(0);
//Obtain AlxNativeAdView.
AlxNativeAdView nativeAdView =(AlxNativeAdView) getLayoutInflater().inflate(R.layout.native_ad_template, null);
// Register and populate the native ad asset views.
initNativeAdView(nativeAd,nativeAdView);
//Add AlxNativeAdView to the UI.
FrameLayout adFrameLayout = (FrameLayout) findViewById(R.id.ad_container);
adFrameLayout.removeAllViews();
adFrameLayout.addView(nativeAdView);
……
}
});
}
private void initNativeAdView(AlxNativeAd nativeAd,AlxNativeAdView nativeView) {
……
// Register and populate the title view.
nativeView.setTitleView(title);
title.setText(nativeAd.getTitle());
// Register and populate the multimedia view.
nativeView.setMediaView(mediaView);
mediaView.setMediaContent(nativeAd.getMediaContent());
// Register and populate other asset views.
……
//Register the native ad object.
nativeView.setNativeAd(nativeAd);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2.5 Destroy an ad.
When the native ad is no longer displayed, you should destroy the ad. Refer to the sample code below:
nativeAd.destroy();
Please refer to the below descriptions for more details of AlxNativeAd:
Method | Param | Description |
---|---|---|
getCreateType | - | Ads type (e.g.: Large image, small image, groups of images, video, Other:Not defined) |
getAdSource | - | Ads source |
getAdLogo | - | Ads logo |
getTitle | - | Ads title |
getDescription | - | Ads Description |
getIcon | - | Ads icon |
getImages | - | Ads image content |
getCallToAction | - | Call to action button, e.g. "more" or "intall" |
getMediaContent | - | Ads multimedia content |
destroy | - | Destroy ads object |
setNativeEventListener | AlxNativeEventListener | Ads event listener |
# Step 4: User Privacy
# 1. GDPR
As a developer, you should integrate a Consent Management Platform (CMP) and request for vendor and purpose consents as outlined in IAB Europe’s "Mobile In-App CMP API v1.0: Transparency & Consent Framework" or "IAB Tech Lab – CMP API v2".
If you are using your own custom CMP in your app or game, the collected end-user consent information needs to be stored in SharedPreferences using the following keys:
Transparency and Consent Framework (TCF) v2:
Key | Type | Description |
---|---|---|
IABTCF_gdprApplies | NSNumber | "1" = Subject to GDPR "0" = Not subject to GDPR "-1" or unset = Undetermined (default before initialization) |
IABTCF_TCString | NSString | Base64-encoded consent string as defined in IAB Tech Lab – Consent string and vendor list formats v2 |
AlgoriX is an approved vendor of IAB Europe’s Transparency and Consent Framework (TCF). For more information about AlgoriX’s compliance of GDPR, you can refer to AlgoriX privacy policy.
AlgoriX SDK automatically retrieves the GDPR value and consent string from SharedPreferences using the keys IABTCF_gdprApplies and IABTCF_TCString.
Alternatively, you can also manually provide specific values for GDPR and consent string using AlgoriX SDK methods below. Please call the below methods only after initiating AlgoriX SDK.
If you have already integrated a CMP and store user consent values in IABTCF_gdprApplies and IABTCF_TCString of SharedPreferences, you don’t need to use the methods below to pass the flag and string again.
AlxAdSDK.setSubjectToGDPR(TRUE);
AlxAdSDK.setUserConsent(<#Base64ConsentString#>); // A valid Base64 encoded consent string as defined at https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework.
2
The "subject to GDPR" flag takes a Boolean value that can be set to YES/TRUE (if the user is subject to GDPR regulations) or NO/FALSE (if the user is not subject to GDPR regulations). This method should only be called if the app has made its own determination as to whether GDPR is applicable to the user or not. If this method is not called, AlgoriX assumes the app has not made such determination, and AlgoriX will apply its own determination of the GDPR applicability.
The setUserConsent method takes a string of either "0" (user does not give consent), "1" (user gives consent) or a more detailed consent string (A valid Base64 encoded consent string as defined at https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework). The more detailed consent string is the consent string as described in the Transparency and Consent Framework as supported by the IAB.
# 2. CCPA
The California Consumer Privacy Act (CCPA) was created to provide California consumers with greater transparency and control over their personal information. As a developer, you need to make sure to request consent from California-based users (to give or refuse consent / to opt-out or opt-in) about private data transfer. For more information about AlgoriX’s compliance of CCPA, you can refer to AlgoriX privacy policy.
Note: If you are updating from a previous version of the AlgoriX SDK and have set privacy values using the old method, don’t worry – the new SDK will still read the previously set values and you do not need to manually set them again. However, we would recommend migrating your code to use this new method.
This example code below shows the setting of US privacy flag. Please call the below methods only after initiating AlgoriX SDK.
AlxAdSDK.subjectToUSPrivacy("1YYY");
The subjectToUSPrivacy method takes a string value for example "1YYY", whose format is defined by IAB Specification.
# 3. Age-Related Regulatory Requirement
Use the method below if you have child-directed apps to flag specific end-users as children, as may be permitted or required by applicable law (e.g., COPPA, GDPR, etc.). Developers of child-directed apps are responsible for determining whether an app is permitted to flag at the end-user level or must treat all end-users as children.
AlxAdSDK.setBelowConsentAge(true);
The setBelowConsentAge method takes a Boolean value and can either be TRUE (If the end-user is a child, as defined by applicable regulations) or FALSE (If the end-user is not a child).
# Step 5: Error Code
During the house ads testing, please don’t not use any VPN.
Value | Description |
---|---|
1100 | Server Error. Please contact your AlgoriX Account Manager or Sales Engineer for further assistance |
1101 | An error in the network request. Check if the network status is normal |
1102 | No ads fill. Check sid and placement id, or contact your AlgoriX Account Manager for further assistance |
1103 | Bad ad creatives, check sid and placement id. Please contact your AlgoriX Account Manager for further assistance |
1104 | Server Error. Please contact your AlgoriX Account Manager for further assistance, During the testing, we suggest please not use any VPN. |
1105 | Server Error. Please contact your AlgoriX Account Manager for further assistance |
1106 | Video request failed, check if the network status is normal |
1107 | Video playback failed, check if the network status is normal |
1108 | Video download failed, unable to playback, check if the network status is normal |
1109 | Video file type not support, unable to playback. Please contact your AlgoriX Account Manager for further assistance |
1110 | Video file doesn’t exist, unable to playback. Please contact your AlgoriX Account Manager for further assistance |
1111 | Wrong parameter, unable to playback |
1112 | Ads rendered failed |
1113 | SDK is not initialized |
3001 | Server Error. Ad format is doesn't match with placement, please contact your AlgoriX Account Manager for further assistance. |
3002 | Server Error. Ad. Ads placement is not enable by AlgoriX admin, please contact your AlgoriX Account. |
3003 | Server Error. Ad. App is not enable by AlgoriX admin, please contact your AlgoriX Account. |