Incentiveized Video Integration Guide(Eclipse) - united-adstir/AdStir-Integration-Guide-Android GitHub Wiki
You'll need to replace all SDKs included in the package when you update a SDK. If you use different versions of SDKs, the system may not operate properly.
Currently, the affilieted network "Vungle" has suspended providing bundled SDK for some reasons. If you update a SDK from old version to latest version, please delete Vungle SDK and its adaptor before you use it.
vungle-publisher-adaptive-id-3.3.5.jar
dagger-2.1.jar
javax.inject-1.jar
androidwebviewmediation-videoreward-vungle.jar
Along with this, the system may get exceptions as below. However, it won't effect on operation, so please keep using it.
java.lang.ClassNotFoundException: com.ad_stir.interstitial.mediationadapter.Vungle
We are sorry for the inconvenience.
Android 4.1 or later
Get SDK from "Get SDK/Code" page on AdStir site.
Get SDK parameter from "Get SDK/Code" page on AdStir site.
Set Compile SDK Version API18 or later.
Put adstirwebview.jar, androidwebviewmediation-*.jar, and bundled all sdks to your project's libs folder. But the bundled Library project must be imported, and add to your project's Property->Android->Library.
AdStir SDK requires Google Play services.
Please setup the library.
** This section will be changed on SDK update. Don't forget checking. **
Add permissions.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
In element, please add following lines.
<activity android:name="com.jirbo.adcolony.AdColonyOverlay"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyFullscreen"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity android:name="com.inmobi.androidsdk.IMBrowserActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:hardwareAccelerated="true" />
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
<activity android:name="com.ad_stir.videoincentive.AdstirFullscreenActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity
android:name="jp.maio.sdk.android.AdFullscreenActivity"
android:label="maiosdk"
android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<data android:scheme="jp.maio.sdk.android"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="com.vungle.publisher.FullScreenAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
If you use ProGuard, please configure following settings.
# adstir
-dontwarn com.ad_stir.**
-keep class com.ad_stir.** { *; }
-keep interface com.ad_stir.** { *; }
# google
-keep class com.google.android.gms.ads.** {*;}
# adcolony
-dontwarn com.jirbo.adcolony.**
-keep class com.jirbo.adcolony.**{*;}
# inmobi
-keep class com.inmobi.** { *; }
-dontwarn com.inmobi.**
# applovin
-dontwarn com.applovin.**
-keep class com.applovin.**.*
# unity-ads
-keepattributes SourceFile,LineNumberTable
-keepattributes JavascriptInterface
-keep class android.webkit.JavascriptInterface {
*;
}
-keep class com.unity3d.ads.** {
*;
}
# maio
-dontwarn jp.maio.**
-keep class jp.maio.** { *; }
-keep interface jp.maio.** { *; }
# vungle
-keep class com.vungle.** { public *; }
-keep class javax.inject.*
-keepattributes *Annotation*
-keepattributes Signature
-keep class dagger.*
-keepattributes EnclosingMethod
// import required classes
import com.ad_stir.videoreward.AdstirVideoReward;
import com.ad_stir.videoreward.AdstirVideoRewardListener;
private boolean isRewarded = false;
// Define listner
private AdstirVideoRewardListener listener = new AdstirVideoRewardListener() {
public void onLoad(int spot_no) {};
public void onFailed(int spot_no) {};
public void onStart(int spot_no) {};
public void onStartFailed(int spot_no) {};
public void onFinished(int spot_no) {};
public void onReward(int spot_no) {
isRewarded = true;
};
public void onRewardCanceled(int spot_no) {};
public void onClose(int spot_no) {};
};
@Override
// Load Ad
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.xxxx);
// Set user identifier for Server-Side Callback
// You have to specify user identifier that your API identify the user.
// AdstirVideoReward.setMediaUserID("XXXXXXXXXXX");
// Initialize spots using this activity.
int[] spotIds = { 1, 2 };
AdstirVideoReward.init(this, "MEDIA-xxxxxx", spotIds);
// Create instance per spot ID.
adstirVideoReward = new AdstirVideoReward(this, "MEDIA-xxxxxx", 1);
// Add listener defined before.
adstirVideoReward.setAdstirVideoRewardListener(listener);
// Start loading...
adstirVideoReward.load();
}
// Resume and Pause, Destroy
@Override
protected void onResume() {
if(adstirVideoReward != null) adstirVideoReward.resume();
if(isRewarded) {
isRewarded = false;
Log.d(TAG, "Reward success.");
}
super.onResume();
}
@Override
protected void onPause() {
if(adstirVideoReward != null) adstirVideoReward.pause();
super.onPause();
}
@Override
protected void onDestroy() {
if(adstirVideoReward != null) adstirVideoReward.destroy();
super.onDestroy();
}
Global initialize method. Please call this before creating AdstirVideoReward instance.
You have to specify all spot numbers you use in app.
- activity : Activity
- mediaId : Medium ID
- spotNoArray : Spot numbers
Set user identifier for Server-Side Callback
- userId : Unique user identifier.
Constructor.
- activity : Activity
- mediaId : Medium ID
- spotNo : Spot number
Set listener.
- listener : Instance that implementing AdstirVideoRewardListner interface
Set application version.
- appVersion : Application version string
Set user location for location-based targeting.
- location : Instance of Location.
Start loading Ad.
Show Ad.
Pause the process. Call in onPause of activity.
Resume the process. Call in onResume of activity.
Destroy instance. Call in onDestroy of activity.
Listener interface.
Notify an Ad was loded.
Notify failed loading Ad.
Notify video was started.
Notify video was finished.
Notify reward was verified.
Notify reward was cancelled.
Notify video was closed.
AdStir supports Server-Side Callback of incentive.
(*) required
Placeholder | Value |
---|---|
${TRANSACTION_ID} (*) | AdStir Reward Transaction Identifier |
${USER_ID} (*) | Media User ID that set before initialization |
${CURRENCY} | Incentive Currency |
${AMOUNT} | Incentive Amount |
${IFA} | Apple IDFA/Google Play Advertising ID |
e.g.) http(s)://aaa.com/bbb?ccc=${TRANSACTION_ID}&ddd=${USER_ID}&eee=${CURRENCY}&fff=${AMOUNT}
Return 200 OK, when API received callback successfully.
- Callback requests might duplicate. So you have to process it uniquely by ${TRANSACTION_ID}.
- ${IFA} might be empty. You have to identify user by ${USER_ID}.
- Callback timeout is set to 60sec.