Search code examples
androidintegrationadscocos2d-android

Adding admob or mobclix to wiengine android app


I'm trying to implement some mobclix ads into an android app based on wiengine which is basically a java port of cocos2d. Has anyone tried doing this? if so please tell me how ;)

To be clear the basic problem is that because wiengine uses a nonstandard View based class (WYGLSurfaceView) you can't easily add another ad View on top of the existing one.

Thanks,

Nick


Solution

  • use Activity.addContentView, samples:

    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
        FrameLayout.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
        lp.bottomMargin = 10;
    AdView ad = new AdView(this);
    ad.setResId("xxx");
    ad.setGoneIfFail(true);
    addContentView(ad, lp);
    ad.requestAd();
    

    full answer: http://blog.wiyun.com/?cat=8