我一直在按照Google指南(https://developers.google.com/admob/android/rewarded-video)在我的应用上安装奖励广告,但是尽管收到了成千上万的请求(如admob报告中所示),但没有提供任何奖励广告。
以下是一些对广告有奖励的活动摘录。
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
public class Ji extends Activity implements RewardedVideoAdListener {
//reward ad
private RewardedVideoAd mRewardedVideoAd;
//ad
private InterstitialAd interstitial;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ji);
MobileAds.initialize(this, "THE_APP_ID");
//reward ad
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
//this is where it occurs
loadRewardedVideoAd();
@Override
protected void onDestroy() {
mRewardedVideoAd.destroy(this);
super.onDestroy();
}
@Override
protected void onResume() {
mRewardedVideoAd.resume(this);
super.onResume();
}
@Override
protected void onPause() {
mRewardedVideoAd.pause(this);
super.onPause();
}
private void loadRewardedVideoAd() {
//actual ad
mRewardedVideoAd.loadAd("THE_AD_ID",
new AdRequest.Builder().build());
}
@Override
public void onRewardedVideoAdLoaded() {
// Toast.makeText(this, "onRewardedVideoAdLoaded", Toast.LENGTH_SHORT).show();
erco = 200;
}
@Override
public void onRewardedVideoAdOpened() {
// Toast.makeText(this, "onRewardedVideoAdOpened", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoStarted() {
// Toast.makeText(this, "onRewardedVideoStarted", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdClosed() {
// Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
// Load the next rewarded video ad.
loadRewardedVideoAd();
}
@Override
public void onRewarded(RewardItem rewardItem) {
// Toast.makeText(this, "onRewarded! currency: " + rewardItem.getType() + " amount: " +
// rewardItem.getAmount(), Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdLeftApplication() {
// Toast.makeText(this, "onRewardedVideoAdLeftApplication",
// Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
// Toast.makeText(this, "onRewardedVideoAdFailedToLoad " + errorCode, Toast.LENGTH_SHORT).show();
erco = errorCode;
}
@Override
public void onRewardedVideoCompleted() {
}
private void d_ao() {
final Dialog ploc = new Dialog(context);
Window window = ploc.getWindow();
window.setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);
ploc.setContentView(R.layout.d_ao);
Button baye = (Button) ploc.findViewById(R.id.ba_yes);
Button bano = (Button) ploc.findViewById(R.id.ba_no);
baye.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mRewardedVideoAd.show();
//reward the user after the ad
ploc.dismiss();
}
});
bano.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ploc.dismiss();
}
});
ploc.show();
}
按照admob指南,我在gradle文件中插入了相关的sdk行。
当前,我正在尝试设置该应用程序以显示插页式广告,以防奖励广告不显示,但是由于某些奇怪的原因,尽管在其他活动中效果很好,插页式广告也无法显示。 / p>
此外,我还想知道一旦显示了奖励广告,奖励金额和奖励项目“奖励”在应用程序中意味着什么。当前,我的目的是让用户在显示奖励视频后通过启用的按钮获得附加功能。每天仅发生一次。我该如何实施?另外,在我的应用中,没有提及与admob相关的“奖励”项目或其金额。
请帮助。