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

dylib seems not working to be imported in Java
Paring json string in java with javax.json
Based on frequency information about a calendar event, how can I check if a given date is during this event?
When to use Soap and when to use Rest [closed]
Caused by: java.lang.ClassCastException: com.example.mayank.sunshine.SettingsActivity cannot be cast to android.app.Activity
List of divisors of a number
JSP & Bootstrap: Why won't this tabs page work?
when the thread will release the lock on object?
Background JSwing Image Loading Oddly
If not working properly [duplicate]
Apache Commons Configurations containsKey returns false on existing key
Implementing express checkout (PayPal) using SOAP
Can't replace one file with other
Android Studio SDK path error
Cannot come up with idea of practice example with RxJava (reactive programming)
Swagger JAX-RS with Jersey 1.19 gives 'Conflicting URI templates' error

Categories

HOME
maven
ms-access
osgi
listview
coq
urbancode
heroku
maven-3
paw-app
sql-server-2016
google-project-tango
installshield
pivotal-cloud-foundry
elasticsearch-hadoop
nano-server
midi
spring-xd
offline
php-7.1
dynamics-crm-online
clearcase-ucm
highlight.js
aurigma
firefox-webextensions
zapier
cx-freeze
scriptcs
arabic
dcevm
format-specifiers
smb
opennlp
url-scheme
bootstrap-material-design
strncpy
typo3-6.2.x
saas
compatibility
directx-10
key-value-observing
phpfreechat
bytecode-manipulation
code-search-engine
leading-zero
sas-visual-analytics
reportingservices-2005
elmah
http-live-streaming
eigenvalue
isbn
sas-jmp
appcompat
filepicker
upstart
elgg
drupal-6
font-size
cudafy.net
redundancy
setuptools
savon
bonobo
bluegiga
goose
phpcas
cartesian-product
jmeter-maven-plugin
computer-algebra-systems
security-testing
tarjans-algorithm
sniffer
system.reflection
codeigniter-url
gui-test-framework
openexr
mesa
dml
jquery-layout
openlaszlo
terminal-services
runtime.exec
google-cloud-save
chronoforms
jelly
onsubmit
buildr
vdsp
appendto
oncheckedchanged
dbal
fixed-width
user-friendly
zend-tool
photoshop-cs4
ctp4
noscript

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App