android - Show AdMob only on spesific screen -
Hey I have a game on Libgdx and I'm trying to add it to the AdMob banner. I have 2 problems with it,
1) The banner takes about a minute to load and show on the screen and it should not be
2) showing on the banner It's been on every screen and I want that it can not show on the game screen only on the menu screen.
Here's the code I used:
Public class Android launcher Android app {AdView adView; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); Android Application Configuration Config = New Android Application Configuration (); // Start (new gameman (), configuration); Relative layout layout = new relative layout (this); // Launching stuff () for your request, WindowFeature (Window.FEATURE_NO_TITLE); GetWindow () Set Flag (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); . GetWindow () clearFlags (WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); See // libgdx GameView = initializeForView (new gamemine), config); Layout.addView (gameView); AdView = new ad view (this); AdView.setAdUnitId ("ca-application-pub-4647665408548722/82 9 3730490"); AdView.setAdSize (AdSize.BANNER); AdRequest adRequest = new AdRequest.builder (). Build (); Relative layout. LayoutParamsAdmin = New Relative Layout LayoutPalm (Relative Layout Layout Layout. WRAP_CONTENT, Relative Layout. LayoutPAM. WRAP_CONTENT); AdParams.addRule (RelativeLayout.ALIGN_PARENT_TOP); AdParams.addRule (RelativeLayout.ALIGN_PARENT_RIGHT); Layout.addView (adview, adapter); // Press adView.loadAd (adRequest) above all; SetContentView (layout); } If someone can answer my questions then it would be great!
The banner actually takes a few minutes to load, so before you show the banner Will have to load. Regarding the second question, when you do not want to show the banner, you should set a false; And when you want, set the right to show it.
Comments
Post a Comment