utkuemre34 / apwidgets

Automatically exported from code.google.com/p/apwidgets
0 stars 0 forks source link

Widgets don't play nice with AdMob ads #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to reproduce the problem:
1. Use an APWidget like APButton
2. Add the following code to invoke an AdMob ad (see below) 

The result is that when you try to click on the ad (just about the only thing 
that creates any revenue), 80% of the click events are intercepted or ignored.  
Remove the APWidgets and the problem goes away.

I'm stumped about what to do to get around this problem.  The app I made was 
supposed to be free with ads, but now I'm facing having to make new buttons and 
retest it on various screen sizes, which I'd rather not do.

What version of the product are you using? On what operating system?
Using AdMob SDK 4.1 and Android 2.2.  APWidgets_r44_for_Java1.5

@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Window window = getWindow();
  RelativeLayout adsLayout = new RelativeLayout(this);
  RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
  RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
  adsLayout.setGravity(Gravity.BOTTOM);
  AdView adView = new AdView(this, AdSize.BANNER, "AD_ID_#");  // add your app-id
  adsLayout.addView(adView);
  AdRequest newAdReq = new AdRequest();
  //newAdReq.setTesting(true);
  adView.loadAd(newAdReq);
  window.addContentView(adsLayout, lp2);
}

Original issue reported on code.google.com by noisefac...@gmail.com on 2 Sep 2011 at 8:28

GoogleCodeExporter commented 9 years ago
I found a work around for my problem that involves making my own version of 
APWidgetContainer (MyAPWidgetContainer) and where it says:

        scrollView.setFillViewport(true);

I changed it to 

        scrollView.setFillViewport(false);

It would be nice if there were an alternative constructor for APWidgetContainer 
that would make it so that it doesn't stretch over the whole parent window 
space.

Original comment by noisefac...@gmail.com on 2 Sep 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Thank you, I´ll make an alternative constructor on the next update.

Original comment by rikard.l...@gmail.com on 4 Sep 2011 at 8:11

GoogleCodeExporter commented 9 years ago
I've got the exact same issue.

When will the next update / bugfix be released? It's urgent. Thank you.

Or is there a way to fix it by myself (I don't understand noisefactors solution)

Original comment by drillser...@gmail.com on 8 Sep 2011 at 9:30

GoogleCodeExporter commented 9 years ago
No problem.  It would be nice to have the alt constructor, though.  Would
keep things cleaner in my code.

Regarding drillser...@gmail.com's misunderstanding of my solution, I'd be
happy to send him code if you have his/her full email.

 Andy

Original comment by noisefac...@gmail.com on 8 Sep 2011 at 3:49

GoogleCodeExporter commented 9 years ago
drillsergeant[dot]info[at]gmail[dot]com

thank you very much

Original comment by drillser...@gmail.com on 8 Sep 2011 at 6:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
noisefactors solution doesn't work for my sketch.
However I found out what the problem was:

I just moved all the APWidget stuff out of the setup into the onCreate funtion.
And the point is : You have to initialize the widgets and containers before you 
create all the admob stuff.
Plain and simple.
Otherwiseit makes the ads in onCreate, then goes into setup() and draws the 
buttons over it (or its view?)

Original comment by drillser...@gmail.com on 11 Sep 2011 at 4:49