AdWhirl触摸拦截

时间:2011-05-05 18:45:09

标签: android touch intercept adwhirl

当玩家触摸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的类? Handle AdWhirl onFailure

我真的不知道如何移动:(

1 个答案:

答案 0 :(得分:-1)

查看库的adWhirlClickMetric方法并查看它的调用时间。只要用户触摸广告横幅(至少在iOS版本的SDK中)就会调用它,并且非常适合您想要做的事情。