android - Admob doesn't show ad until second request -


There are questions about this and some different answers - none of which seems to work for me.

I have a libdgx app, which makes me guess a little bit, but I do not think this is causing the problem. The code below for my on creates is below.

I have been assigned an Adlivener which is said to be when the load is loaded. This code is being hit but nothing is being shown. If I set the ad to refresh, then it will be shown after the first refresh. If I call loaded second for a second time after a short wait, then the banner will show. If I send load ed on two consecutive lines then the ad will not show.

Edit: I have also noticed that I can click the ad, even though I do not see the ad. I play back when the ad clicks on showing the ad correctly.

edit2: I changed the ad in a SMART_BANNER instead of the banner and it seems that I still do not know what the banner is working because I expected to do the job.

  Crate on public void (bundled savedinstenstate) {super.onCreate (savedInstanceState); // Layout Frame Layout Layout = Create New FrameLayout (this); // Launching stuff () for your request, WindowFeature (Window.FEATURE_NO_TITLE); GetWindow () SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN | window manager. LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); . GetWindow () clearFlags (WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); Android Application Configuration Config = New Android Application Configuration (); Config.useAccelerometer = false; Config.useCompass = false; Config.useWakelock = false; Config.useImmersiveMode = True; Config.hideStatusBar = True; See // libgdx GameView = initializeForView (New WordStormGame (this), config); // add libgdx view layout. AddView (gameView); AdView = new ad view (this); AdView.setAdUnitId ("XXXXXXXXXXXX"); AdView.setAdSize (AdSize.BANNER); AdView.setAdListener (New AdListener () {Public Zero () on Adloaded Gdx.app.log ("Advertisement", "Ad Load");}}); // AdMob view FrameLayout.LayoutParams adsParams = new FrameLayout.LayoutParams (FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL) Add; Layout. AddView (ad view, advertisement param); // Set up all contentview (layout); AdView.loadAd (New AdRequest.Builder (.) Build ()); The solution is finally as simple as connecting the line  

adView.setBackgroundColor (Color.TRANSPARENT);

My final adview build code looks like this:

  Private Zero createAdView () {abBuilder = New AdRequest.Builder (); AbBuilder.addTestDevice ("xxxxxxx"); If (adView! = Null) (ViewManager) adView.getParent ()). Deleted scenes (adView); AdView = new ad view (this); AdView.setAdUnitId ("xxxxxxx"); AdView.setAdSize (AdSize.SMART_BANNER); adView.setAdListener (New AdListener () {public void onAdLoaded () {if (adsShown) adView.setVisibility (View.VISIBLE); Gdx.app.log ( "the ad", "advertising load");}}); AdView.setBackgroundColor (Color.TRANSPARENT); // AdMob view RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT) Add; AdParams.addRule (RelativeLayout.ALIGN_PARENT_TOP); Layout.addView (adview, adapter); }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -