Repository navigation
Home
This document describes how to access Arrkii SDK for Android apps.
Step 1 Obtain Identity Publisher ID is the identifier of a developer's identity in Arrkii's advertising platform. App ID is the unique identifier of a developer’s APP at Arrkii Developer Platform. Each app will have its own App_ID.
You can get PubID & create your AppID in this site: www.arrkii.com
Step 2 Load the Arrkii SDK package & configure the AndroidManifest.xml file Copy the SDK's jar(and any .so) file(s) to your Android project & configurate the Manifest.xml file by adding the following code:
copy this codes to your manifest:
<!-- Arrkii permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Arrkii Componment (optional)—>
<receiver
android:name="com.arrkii.nativesdk.core.AKReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
Step 3 Initialization
- SDK initialization
//Initialization the SDK
SDK.init(Context,"Publisher ID", "App ID");- LoadAds & preLoadAd
/**
* Description : LoadAds
* @param pubID: pubID
* @param appID: appID
* @param subID: subID , If need to send a sub channel code, otherwise passing "null"
* @param adNum: number of ads to load,max=50
* @param offset: offset, example: adNum=10,offset=10, that will return No.11-No.20 Campaign
* @param listener: callback
*/
SDK.getInstance(this).loadAd("5745", "232", null, 10, 0, new AdListener(){
@Override
public void onLoadFinish(List<Campaign> list) {
//result here.
if(list != null){
//Each campaign has data of native ad: name, packageName, clickURL ect.
}
}
@Override
public void onPreLoadFinish(Campaign campaign) {
//preLoadAd will using this callback,nothing here.
}
@Override
public void onLoadFailed(String msg) {
//load failed.
}
});/**
* Description : Preload
* @param pubID: pubID
* @param appID: appID
* @param subID: subID , If need to send a sub channel code, otherwise passing "null"
* @param listener: callback
*/
SDK.getInstance(this).preLoadAd("9780", "389", null, new AdListener() {
@Override
public void onLoadFinish(List<Campaign> list) {
//LoadAd will using this callback,nothing here.
}
@Override
public void onPreLoadFinish(Campaign campaign) {
//get campaign here
}
@Override
public void onLoadFailed(String s) {
//load failed.
}
});NOTE Difference between LoadAds & preLoadAd:
LoadAds: can get multiple results, apply for appwall,cards,feeds
preLoadAd:can get only one result, but is optimized by SDK, faster redirection, apply for interstitial,icon
-
Impression
/** * Description : Impression (tell SDK this campaign is shown) * @param campaign: campaign from loadads/preLoadAd */ SDK.getInstance(this).showAd(campaign);
-
click
/**
* Description : click
* @param campaign: campaign from loadads/preLoadAd
* @param gotoMarket: auto to Google play, default is passing:true
* @param listener: callback
*/
SDK.getInstance(this).clickAd(camp, true, new ClickListener() {
@Override
public void onAdClicked(Campaign campaign, String link, int type) {
//success
}
@Override
public void onAdClickFailed(Campaign campaign, String msg) {
//Failed
}
});NOTE If you need to obfuscate code, the rules for obfuscating are shown below: A: Exclude all classes of Arrkii SDK when obfuscating; B: Below classes can add to proguard configuration:
-keep class com.arrkii.** {*; }
-keep interface com.arrkii.** {*; }
Enable Test mode:
To enable test mode, using this code to init the SDK:
//Initialization the SDK with test mode
//param in the end is "enable test mode"
SDK.init(this,"Publisher ID", "App ID", true);
After finishing the integration & enable test mode, run your app & check the logcat(No Filters),if you can see the "salvia loop" logcat, this means the SDK has been successfully integrated.