Is it possible to determine when an app is closing whether it is done by normal means (home button) or because an ad was clicked (admob ad for this example)... Admob doesn't have anything that would help accomplish this goal does it? Any ideas where to start would be greatly appreciated...
+2
A:
If no other/better means are available, put a UIView over the ad area, detect touches on it, make a note then pass that to the next responder (which is the ad's view).
In other words, you need a method you can call to tell you that admob was clicked, and a subclass of UIView, which is positioned right over the admod view, that has the following touchesBegan:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// you may want to do some extra work here to detect whether the touch is a
// touchUp in the view, vs. a touchUpOutside which is not the same. It all
// depends on how admob treats touches. If it immediately quits your app on
// touchdown, then you call your method immediately. If admob waits to see
// if there is a touchUp in its view, then you need to detect the same and
// call your method after that. Play around to see what you need to mimic.
[self adViewHasBeenTouched];
// The following is needed to let admob get the touch, after you are done
// with your method.
[self.nextResponder touchesBegan:touches withEvent:event];
}
mahboudz
2009-10-22 06:23:48
Do you have an example of how I would accomplish this using admobs sdk?
charlie
2009-10-23 20:31:21
I haven't used admob. This method would not require admob. You make a view that resides over admob's area. That view will have to handle touches as I show, and then pass the touch off to the next responder so admob gets its touch.
mahboudz
2009-10-24 04:36:40