protected <RewardedVideoAdListener> void onCreate(Bundle savedInstanceState) {

24 views
Skip to first unread message

Soufien Ethny

unread,
Aug 9, 2022, 3:57:05 PM8/9/22
to Google Mobile Ads SDK Developers
Hello everyone,
Can I please get some help from you guys, I'm kinda stuck with these two codes. Can I have some explanations ??


1-
protected <RewardedVideoAdListener> void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.custom_dialog);
yes = (Button) findViewById(R.id.btn_yes);
no = (Button) findViewById(R.id.btn_no);
yes.setOnClickListener(this);
no.setOnClickListener(this);
mAd = (RewardedVideoAd) MobileAds.getRewardedVideoAdInstance(c);
mAd.setRewardedVideoAdListener((RewardedVideoAdListener) c);

2-
public void loadRewardedVideo() {
mAd.loadAd(Constant.rewarded_ad_id,
new AdRequest.Builder()
.build());
}


thanks in advance


Mobile Ads SDK Forum Advisor

unread,
Aug 10, 2022, 1:07:39 AM8/10/22
to ethn...@gmail.com, google-adm...@googlegroups.com

Hi Soufien,

Thank you for reaching out to us.

With regard to your concern, let me answer it below.

1-

protected <RewardedVideoAdListener> void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.custom_dialog);

yes = (Button) findViewById(R.id.btn_yes);

no = (Button) findViewById(R.id.btn_no);

yes.setOnClickListener(this);

no.setOnClickListener(this);

mAd = (RewardedVideoAd) MobileAds.getRewardedVideoAdInstance(c);

mAd.setRewardedVideoAdListener((RewardedVideoAdListener) c);

  • As per checking on this code, I've seen that "getRewardedVideoAdInstance" has already been removed on the v20.0.0 of the SDK and is not used now on the latest version.

2-

public void loadRewardedVideo() {

mAd.loadAd(Constant.rewarded_ad_id,

new AdRequest.Builder()

.build());

}

  • For this, the latest request process of the rewarded ads is now using " RewardedAd.load()". It has already been changed on the v20.0.0 of the SDK.

It seems that you're using the previous version of the v19.5.0 below. Kindly make sure that you're using the latest AdMob SDK to avoid any errors in your implementation.

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2dJ4eg:ref
Reply all
Reply to author
Forward
0 new messages