这是我的AdMob奖励视频广告代码,请帮助我确定应添加哪些代码以进行虚假广告中介,并正确导入和显示SDK。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_ad);
ButterKnife.bind(this);
init();
}
//在这里,我从admob初始化视频广告 私人无效init(){
MobileAds.initialize(this, getResources().getString(R.string.Reward_ad_id));
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
loadRewardedVideo();
onVideoAdLoading();
attachListener();
syncManager = new SyncManager();
}
//侦听器
private void attachListener() {
goBackBtn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
finish();
}
});
}
//从admob加载重新播放的视频 公共无效loadRewardedVideo()
{
mRewardedVideoAd.loadAd(getResources().getString(R.string.Reward_ad_id), new AdRequest.Builder().build());
}
//显示来自admob的奖励视频广告
@Override
public void onRewardedVideoAdLoaded()
{
mRewardedVideoAd.show();
}