Titanium JIRA Archive
Appcelerator Community (AC)

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

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2018-12-17T21:35:50.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsn/a
Reporterlindsay@radioreference.com
AssigneeShak Hossain
Created2018-12-14T19:25:26.000+0000
Updated2018-12-17T21:35:50.000+0000

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.

Comments

  1. Sharif AbuDarda 2018-12-15

    Hello, This error shows when you don't have an internet connection. Make sure you are connected to the internet. Share a full trace log of the issue if you see the issue under internet connection. Thanks.
  2. lindsay@radioreference.com 2018-12-15

    It turns out I was developing on a network with a Pihole installed which was blocking all DNS queries to Googles Play Services. Whitelisting the dev environment fixed the problem. Thanks for your assistance!

JSON Source