Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12752] Ti.UI.iOS.AdView: Does not fire click/singletap/touchstart events

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-26T22:31:05.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsexalture
ReporterBasar Simitci
AssigneeEric Merriman
Created2013-02-14T11:07:41.000+0000
Updated2017-06-26T22:31:10.000+0000

Description

Problem

The recent documentation shows that Ti.UI.iOS.AdView inherits the click/singletap/touchstart events but none of these events are fired when the iAd banner is clicked. This makes it impossible to detect when the user clicks an ad and the ad covers the entire screen and in turn makes it impossible to use iAd with apps that must be paused when the ad covers the screen.

Test Case

var win = Ti.UI.createWindow({
    orientationModes: [ Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT ],
    layout: "absolute"
});

var iAdView = Ti.UI.iOS.createAdView({
    bottom: "0px",
    height: Ti.UI.SIZE,
    width: Ti.UI.SIZE,
    adSize: Ti.UI.iOS.AD_SIZE_PORTRAIT,
});
iAdView.addEventListener("load", function (e) {
    alert("iad - loaded");
});
iAdView.addEventListener("error", function (e) {
    alert("iad - error");
});
iAdView.addEventListener("action", function (e) {
    //runs when ad is dismissed by the user
    alert("iad - action");
});
iAdView.addEventListener("click", function (e) {
    //never runs
    alert("iad - click");
});
iAdView.addEventListener("singletap", function (e) {
    //never runs
    alert("iad - singletap");
});
iAdView.addEventListener("touchstart", function (e) {
    //never runs
    alert("iad - touchstart");
});

win.add(iAdView);
win.open();

Community Discussion

http://developer.appcelerator.com/question/148233/how-to-capture-iad-banner-click

Comments

  1. srikanth ravipati 2013-03-19

    Native ios ADBannerView does not support click,touch and tap events.
  2. Basar Simitci 2013-03-19

    I don't think this is true. The ADBannerView calls a method when user taps the banner. Quoting from the iAd Programming Guide (http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/iAd_Guide/WorkingwithBannerViews/WorkingwithBannerViews.html#//apple_ref/doc/uid/TP40009881-CH4-SW3); ~~~ Responding to a Touch in the Banner View Before the banner view triggers an advertising action, it calls the delegate’s bannerViewActionShouldBegin:willLeaveApplication: method. Your delegate method performs two tasks: It decides whether to allow the action to be triggered. If the action will cover your application’s user interface, this method pauses any activities that require user interaction. Your delegate should return YES from this method if it wants to allow the action to be triggered. It can prevent the action from being triggered by returning NO. Your application should always allow actions to be triggered unless it cannot safely do so. If the willLeave parameter is YES, then your application is going to be moved to the background after it returns from this delegate method. This process is described in “Understanding an Application’s States and Transitions” in iOS App Programming Guide. If the willLeave parameter is NO, iAd covers the application’s user interface after it returns from this delegate method. Your application should disable sounds, animations or other activities that require user interaction before returning. For example, a real-time game should pause gameplay, then return YES to allow the action to be triggered. ~~~ This functionality should be exposed as an event. Otherwise Ti.UI.iOS.AdView is useless.
  3. Tim Poulsen 2013-04-25

    Our documents indicate the 'action' event should fire when a "banner action" has taken place. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.iOS.AdView-event-action Reports from our Titans indicate this used to work. Likely a regression. Please reinvestigate and fix.
  4. Michael Woode 2015-01-09

    This is still an issue, when will a fix be in place? Ti sdk 3.4.1 GA Ti Studio build 3.4.1.201410281727 Native there is a property (or variable in swift) - "actionInProgress", which would indicate something is happening with the ad. But an Ti-event would be better.
  5. Lee Morris 2017-06-26

    Closing ticket as iAd is no longer supported.

JSON Source