Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6066

ti.admob [ERROR] : Failed to receive ad: Request Error: A network error occurred.

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Invalid
    • Affects Version/s: Appcelerator Studio 4.5.0
    • Component/s: Appcelerator Modules
    • Labels:
      None
    • Environment:

      SDK 7.5.0
      Android ti.admob 4.4.0
      iOS ti.admob 2.4.0

      Description

      Running the sample app for the ti.admob module for Titanium, I am unable to get any Admob ads served using existing Ad IDs or using the test Ad ID Placements of

      Banner: ca-app-pub-3940256099942544/2934735716
      Interstitial: ca-app-pub-3940256099942544/4411468910

      Here is the iOS code I'm using to test.

      var Admob = require('ti.admob');
      var win = Ti.UI.createWindow(

      { backgroundColor: 'white', orientationModes: [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT] }

      );

      /*
      We'll make two ads. This first one doesn't care about where the user is located.
      */
      var ad1 = Admob.createView(

      { width: 320, // Will calculate the width internally to fit its container if not specified height: 50, bottom: 0, debugEnabled: false, // If enabled, a dummy value for `adUnitId` will be used to test adType: Admob.AD_TYPE_BANNER, adUnitId: 'ca-app-pub-3940256099942544/2934735716', // You can get your own at http: //www.admob.com/ adBackgroundColor: 'black' }

      );
      win.add(ad1);

      ad1.addEventListener('didReceiveAd', function(e)

      { Ti.API.info('Did receive ad: ' + e.adUnitId + '!'); }

      );
      ad1.addEventListener('didFailToReceiveAd', function(e)

      { Ti.API.error('Failed to receive ad: ' + e.error); }

      );
      ad1.addEventListener('willPresentScreen', function()

      { Ti.API.info('Presenting screen!'); }

      );
      ad1.addEventListener('willDismissScreen', function()

      { Ti.API.info('Dismissing screen!'); }

      );
      ad1.addEventListener('didDismissScreen', function()

      { Ti.API.info('Dismissed screen!'); }

      );
      ad1.addEventListener('willLeaveApplication', function()

      { Ti.API.info('Leaving the app!'); }

      );
      ad1.addEventListener('didReceiveInAppPurchase', function(e)

      { Ti.API.info('Did receive an In-App purchase: ' + e.productId + '!'); Ti.API.info(e); }

      );

      var btn = Ti.UI.createButton(

      { title: 'Show interstitial' }

      );

      btn.addEventListener('click', function() {
      var ad2 = Admob.createView(

      { debugEnabled: false, // If enabled, a dummy value for `adUnitId` will be used to test adType: Admob.AD_TYPE_INTERSTITIAL, adUnitId: 'ca-app-pub-3940256099942544/4411468910' }

      );
      ad2.receive();

      ad2.addEventListener('didReceiveAd', function(e)

      { Ti.API.info('Did receive ad!'); }

      );

      ad2.addEventListener('didFailToReceiveAd', function(e)

      { Ti.API.error('Failed to receive ad: ' + e.error); }

      );
      });

      win.add(btn);

      win.add(Ti.UI.createLabel(

      { text: 'Loading the ads now! ' + 'Note that there may be a several minute delay ' + 'if you have not viewed an ad in over 24 hours.', top: 40, textAlign: 'center' }

      ));
      win.open();

      I receive the following error:

      [ERROR] : Failed to receive ad: Request Error: A network error occurred.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              lindsay@radioreference.com lindsay@radioreference.com
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code