My problem is that they do not appear or show the banner on the screen, now my code that is from the official website of admob does not work, the page is: this .
The code is this:
private void crear(){
SurfaceView gameView = new SurfaceView(this);
// Create and load the AdView.
adView = new AdView(this);
adView.setAdUnitId("ca-app-pub-1765002374395487/9026293652");
adView.setAdSize(AdSize.SMART_BANNER);
// Create a RelativeLayout as the main layout and add the gameView.
RelativeLayout mainLayout = new RelativeLayout(this);
mainLayout.addView(gameView);
// Add adView to the bottom of the screen.
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
mainLayout.addView(adView, adParams);
showBanner();
}
private void showBanner() {
adView.setVisibility(View.VISIBLE);
adView.loadAd(new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build());
}
This code is the same as that given by admob except that I have modified it by placing it within a method.
If you know where I fail please tell me or know another way, I'll be happy to hear your idea. Thanks