ads - Applovin AdclickListener not working in android -
i integrating applovin sdk integrate ads in app.my app game app , want user reward coins when click on ads.but adclicklistener of applovin seems not working in case.
the code:
private applovinadview adview; // create applovin ad view final applovinsdk sdk = applovinsdk.getinstance(sceneactivity.this); adview = new applovinadview(sdk, applovinadsize.interstitial, sceneactivity.this); //show ad after 4 levels if (currentlevel % 4 == 0) { // ad available display. it's safe call show. applovininterstitialad.show(sceneactivity.this); adview.loadnextad(); } adview.setadclicklistener(new applovinadclicklistener() { @suppresslint("simpledateformat") @override public void adclicked(applovinad arg0) { system.out.println("adclicked"); simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); string today = sdf.format(new date()); if (!today.equalsignorecase(getlastdownloaddate())) { // give coins once per day modifymoney(money_download_game); // put last download date setlastdownloaddate(today); } } });
the interstitial ad displaying click listener not working.
the problem mixing applovininterstitialad
(which internally owns own instance of applovinadview
) , own standalone applovinadview
. when call applovininterstitialad.show()
, you're bypassing ad view had listener attached it.
so don't need use applovinadview
@ all... give try:
private void showinterstitial() { final applovinsdk sdk = applovinsdk.getinstance(mactivity); final applovininterstitialaddialog addialog = applovininterstitialad.create(sdk, mactivity); addialog.setadclicklistener(new applovinadclicklistener() { @override public void adclicked(applovinad applovinad) { // ad clicked, add on-click logic here } }); addialog.show(); // display pre-cached interstitial }
Comments
Post a Comment