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 的类? 处理 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看库的
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.