I've made an app using PhoneGap 3.0, which includes the Google AdMob and Facebook SDKs.
Sometimes, after the app is suspended (by pressing "home" for example), when it's launched again the browser viewport is blank (the AdMob ad at the bottom of the screen is still displayed). As soon as you touch inside the web view it renders the page correctly. Around 5 pixels at the bottom of the web view remain visible at all times.
I tried to get a screenshot to include here, but taking a screenshot also causes the page to be rendered correctly!
It sounds like an internal issue with Android/HTC Sense/drivers etc. The problem occurs when I test the app in Android 4.3 on an HTC One. I've also tried it on 2.3 and I can't reproduce the issue.
There isn't anything useful in the LogCat messages - the only event that might be related is MainScreen - Summary updated
, which occurs when I touch the web view to force it to render the contents.
My next steps are to create a blank PhoneGap app to see if I can reproduce it, adding functionality (Facebook, AdMob) a bit at a time until it happens again to try and pinpoint the cause.
Does anyone have any experience of a similar issue, or could you suggest anything I can try?
UPDATE
If I remove the code the loads the AdMob ad, the problem goes away. This is definitely caused by AdMob. This is the code I'm using to load the Ad:
mHandler.postDelayed(new Runnable() {
public void run() {
loadAd();
}
}, 2000);
private void loadAd() {
adView = new AdView(this, AdSize.BANNER, "my-id");
LinearLayout layout = super.root;
layout.addView(adView);
layout.setHorizontalGravity(android.view.Gravity.CENTER_HORIZONTAL);
adView.loadAd(new AdRequest());
}