Hi,
I am trying to implement Admob directly in Android without going through pluginx, or changing anything is my js
files…
Created AdUnit and implemented the AdView as follows:
AdRequest request = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("AC2DFFFAFB44FE1EBC80F6B40559AB14")
.build();
AdView adView = new AdView(AppActivity.this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-XYZ/XYZ");
adView.loadAd(request);
@SuppressWarnings("deprecation")
ViewGroup.LayoutParams ad_layout_params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
adView.setLayoutParams(ad_layout_params);
mFrameLayout.addView(adView);
In Logcat, I am getting the following, the AD is not displayed !!
Starting ad request.
JS: [Some JS Logs]
Ad finished loading.
Scheduling ad refresh 60000 milliseconds from now.
Ad is not visible. Not refreshing ad.
Scheduling ad refresh 60000 milliseconds from now.
Ad is not visible. Not refreshing ad.
Scheduling ad refresh 60000 milliseconds from now.
Ad is not visible. Not refreshing ad.
[repeating]
I guess, the admob Integration is done right, but issue with adding the AdView to the right parent view or issue with setting the position of AdView.
As per this thread (http://stackoverflow.com/questions/25089759/move-adview-to-bottom-cocos2dx-activity), changed the mFrameLayout
in Cocos2dxActivity
to RelativeLayout
PS: Not sure if this is the right forum to post this, since its completely related to android !! Moderators, please move it to right place, If it dont fit here