java


Interstital ad won't load


I'm trying to get a interstital ad and a banner ad to load when an activity is launched. The banner ad is working fine but the interstital ad is just not showing up. Can anyone help me? Here is my code from the onCreate() void.
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(getString(R.string.bigAdID));
adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
if(interstitial.isLoaded()){
interstitial.show();}
Thanks
https://firebase.google.com/docs/admob/android/interstitial
Because of their larger size, interstitial ads require more bandwidth on average than traditional banners. To accommodate this, the recommended approach is to have apps load them in advance of when they will be displayed. This helps ensure that an ad is ready to go when the time comes to display one.
You should wait for interstitial to be loaded.
change your code
if(interstitial.isLoaded()){
interstitial.show();}
to
interstitial.setAdListener(new AdListener(){
if(interstitial.isLoaded()){
interstitial.show();}
});
On a side note - it's not good practice to show interstitial ads as soon as activity is loaded, wait for an appropriate action from user and show it https://support.google.com/admob/answer/6201362?hl=en

Related Links

Adding header to all request with Retrofit 2
Android camera preview freezes suddenly
I'm trying to copy a Formula from one column to the next using Apache POI
How to add lines in this java code?
Java PrintWriter not writing to file [closed]
Gradle Task failing because JSHint detect improvement on code
Generic array creation error on ArrayList [duplicate]
launch java desktop application without eclipse
Android Studio Farsi string
How to remove blank lines in middle of a string Android
Unable to open jar executable in windows
where can we download the oracle.xml.diff package jar. I need to import in a java program of mine
Using Shared preferences to save a string on a button click
How does Android's setOnCLickListener() works?
CRUD Architecture design - deserialization
super constructor in CustomArrayAdapter

Categories

HOME
xamarin
atom-editor
amazon-ec2
single-sign-on
appx
vmware
razor
upload
basic
applepay
dacpac
python-unittest
correlation
collectd
textfield
paging
cloudhub
crystal-reports-2010
one-to-many
tdd
bootstrap-duallistbox
internet-explorer-9
filezilla
maquette
large-file-upload
windows-server-2000
react-chartjs
y86
vxworks
reportingservices-2005
estimote
reactive-cocoa-5
segment
scorm
osx-mavericks
hibernate-tools
pg-dump
boost-preprocessor
windows-iot-core-10
httplistener
log4c
fody
nsviewcontroller
prettytensor
master-slave
dlna
oauth2client
asp.net5
msys
endeca-workbench
eclipse-clp
atk4
kcachegrind
riak-cs
deis
php-ci
method-parameters
operation
skos
xc16
camanjs
android-nested-fragment
aqtime
tidy
apc
jplaton
cos
mylyn
free-variable
gil
google-email-migration
frameset
postgresql-performance
pendrive
propagation
iphone-web-app
xfbml
radcombobox
subviews
sortable-tables
.nettiers
virtual-functions
phonon

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App