来
今天简单介绍下国外的一些主流广告平台,主要介绍其中的视频奖励广告
- Vungle
领先的In-app视频广告平台,被Business Insider评为15家热门的未上市广告技术公司。主要应用在游戏类app上,其中娱乐场类游戏占比较高。
集成方式:
- 添加依赖
dependencies {
// Vungle SDK
implementation 'com.vungle:publisher-sdk-android:6.4.11'
// Either appcompat-v7 or support-v4 is need for SDK operation
implementation 'com.android.support:appcompat-v7:28.0.0' // Either
implementation 'com.android.support:support-v4:27.1.1' // Or
// Recommended for SDK to be able to get Android Advertising ID
implementation 'com.google.android.gms:play-services-basement:16.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
}
- 初始化
Vungle.init("YOUR_VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {
@Override
public void onSuccess() {
// Initialization has succeeded and SDK is ready to load an ad or play one if there
// is one pre-cached already
}
@Override
public void onError(Throwable throwable) {
// Initialization error occurred - throwable.getLocalizedMessage() contains error message
}
@Override
public void onAutoCacheAdAvailable(String placementId) {
// Callback to notify when an ad becomes available for the cache optimized placement
// NOTE: This callback works only for the cache optimized placement. Otherwise, please use
// LoadAdCallback with loadAd API for loading placements.
}
};
- 请求广告
if (Vungle.isInitialized()) {
Vungle.loadAd("YOUR_REWARD_Placement_reference_id", new LoadAdCallback() {
@Override
public void onAdLoad(String placementReferenceId) {
}
@Override
public void onError(String placementReferenceId, Throwable throwable) {
// Load ad error occurred - throwable.getLocalizedMessage() contains error message
}
});
}
- 播放广告
if (Vungle.canPlayAd("YOUR_REWARD_Placement_reference_id")) {
AdConfig adConfig = new AdConfig();
// 静音播放
// adConfig.setMuted(true);
// 自动控制广告方向
// adConfig.setAutoRotate(true);
Vungle.playAd("YOUR_REWARD_Placement_reference_id", adConfig, new PlayAdCallback() {
@Override
public void onAdStart(String placementReferenceId) {
}
@Override
public