AdWhirl 触摸拦截

发布于 2024-11-05 01:27:55 字数 1125 浏览 5 评论 0原文

当玩家触摸 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

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

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 know how to move :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以酷 2024-11-12 01:27:55

查看库的 adWhirlClickMetric 方法并查看它何时被调用。每当用户触摸广告横幅时(至少在 SDK 的 iOS 版本中)就会调用它,并且非常适合您想要执行的操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文