How to increase the virtual coins when a banner ad is pressed

169 Views Asked by At

I have an app in which i have included virtual coins for the users to purchase things like new themes,skins etc etc....And the way to earn these virtual coins is to click on the banner ads(admob ads).Every time the user clicks on the ads the virtual coins should increase by 10.The problem is, i am not able to detect the click on the ads...How do i detect a click on the banner ad? Note:I have integrated the admob ads through the XML file......So please dont give an answer which does it for the programatically defined admob ads.

Thanks :)

1

There are 1 best solutions below

0
On

You can use onInterceptTouchEvent. Please read more about this method. onInterceptTouchEvent

// We intercept clicks

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
    boolean result = super.onInterceptTouchEvent(event);
    switch (event.getAction()) {

    case MotionEvent.ACTION_DOWN:
                    // Click!
        break;
    }

    return result;
}