how can I understand If user clicked on admob ad? ontouch listener didnt work.
Display display = ((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
Window window = getWindow();
adsLayout = new RelativeLayout(this);
RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(//width,height);
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
adsLayout.setGravity(Gravity.BOTTOM);
adView = new AdView(this, AdSize.BANNER, "XXX");
com.google.ads.AdRequest adRequest1 = new com.google.ads.AdRequest();
adRequest1.addTestDevice(com.google.ads.AdRequest.TEST_EMULATOR); // Emulator
int adwidth = height;
adView.setPadding((width - adwidth) / 2, 0, 0, 0);
adView.loadAd(adRequest1);
adsLayout.addView(adView);
adView.setOnTouchListener( (android.view.View.OnTouchListener) mOnTouchListener );
window.addContentView(adsLayout,lp2);
second question is how to manage ads If they on the top of a button or something touching? android works on many phones and can’t test all.. just read that’s forbidden..
The SDK provides you with callbacks when important events occur. The
onPresentScreenmethod will get called prior to exiting your app and going to the click through url. Just have your class implement AdListener and then calladView.setAdListener(this);