java - Rewarded Videos doesn't load the first time but loads after -
my app has button open reward videos >> when button pressed first time, toasts "check internet connection", when hit second or third time, shows video no problems
mobileads.initialize(getactivity(), getstring(r.string.vid_app_id)); mrewardvideoad = mobileads.getrewardedvideoadinstance(getactivity()); mrewardvideoad.loadad(getstring(r.string.vid_app_unit_id), new adrequest.builder() .addtestdevice(getstring(r.string.testdeviceid)) .build()); mrewardvideoad.setrewardedvideoadlistener(this); loadrewardedvideoad();
here methods used :
private void loadrewardedvideoad() { mrewardvideoad.loadad(getstring(r.string.vid_app_unit_id), new adrequest.builder() .addtestdevice(getstring(r.string.testdeviceid)) .build()); } @onclick(r.id.button_more_money) public void more_money() { if (mrewardvideoad.isloaded()) { mrewardvideoad.show(); } else { toast.maketext(getactivity(), "check internet connection", toast.length_long).show(); loadrewardedvideoad(); } } @override public void onresume() { mrewardvideoad.resume(getactivity()); super.onresume(); loadrewardedvideoad(); }
edit: solved - took time , solution load @ oncreate() martin de simone , avi levin
rewarded videos take time load, code fine, first time pressing, video loading , when press video has loaded.
try toast in onadloaded check this
Comments
Post a Comment