I'd like to make an action (increment a counter) when a player touch the ad of the adwhirl banner. I've seen that the AdWhirl class have a method that is called every touch:
//We intercept clicks to provide raw metrics
public boolean onInterceptTouchEvent(MotionEvent event) {
switch(event.getAction()) {
//Sending on an ACTION_DOWN isn't 100% correct... user could have touched down and dragged out. Unlikely though.
case MotionEvent.ACTION_DOWN:
Log.d(AdWhirlUtil.ADWHIRL, "Intercepted ACTION_DOWN event");
countClickThreaded();
if(activeRation.type == 9) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(custom.link));
this.context.startActivity(intent);
}
break;
}
// Return false so subViews can process event normally.
return false;
}
Well, how can I use it? Should I implement a listener? Or maybe a class that implements the AdWhirlInterface like this one? Handle AdWhirl onFailure
I really don't k开发者_如何学Pythonnow how to move :(
Check out the adWhirlClickMetric
method of the library and see when it is called. It is called whenever a user touches an ad banner (in the iOS version of the SDK at least) and would be perfect for what you want to do.
精彩评论