当玩家触摸adwhirl横幅的广告时,我想做一个动作(增加一个计数器)。我看到AdWhirl类有一个方法每次触摸都被调用:
//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;
}
那我怎么用呢?我应该实现侦听器吗?或者像这样实现AdWhirlInterface的类?处理AdWhirl onFailure
我真的不知道怎么移动
查看库的adWhirlClickMetric
方法,并查看何时调用它。当用户触摸广告横幅时(至少在iOS版本的SDK中),它就会被调用,这对于你想做的事情来说是完美的。