2014-02-11 2 views
2

AndEngine에서 만든 게임에 adMob 광고를 표시하려고합니다.ANDEngine ADmob AD not displayed

LogCat의 WebRequest에 대해 WebViewResponse를 얻을 수 있으며 네트워크 권한을 제거하면 네트워크 요구 사항 오류가있는 블랙 박스가 나타납니다. 하지만 네트워크 요구 사항을 추가하면 웹 응답은 수신되지만 표시에는 성공하지 못합니다.

무엇이 문제 일 수 있습니까?

감사합니다.

@Override 
protected void onSetContentView() { 


    final FrameLayout frameLayout = new FrameLayout(this); 
    final FrameLayout.LayoutParams frameLayoutLayoutParams = 
      new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, 
             FrameLayout.LayoutParams.FILL_PARENT); 

    adView = new AdView(this, AdSize.BANNER, “xxxxxxxxx”); 

    adView.refreshDrawableState(); 
    adView.setVisibility(AdView.VISIBLE); 
    final FrameLayout.LayoutParams adViewLayoutParams = 
      new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, 
             FrameLayout.LayoutParams.WRAP_CONTENT, 
             Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL); 

    int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, 
      getResources().getDisplayMetrics()); 
    // top of AD is at middle of the screen 
    adViewLayoutParams.topMargin = height/2; 
    Log.v("AD", "Adview height : " + height); 
    Log.v("AD", "Adview size {x:" + adView.getWidth() + ", y: " + adView.getHeight()+ "}"); 
    adView.setAlpha(255); 

    AdRequest adRequest = new AdRequest(); 
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR); 
    adRequest.addTestDevice(“xxxxxxxxxxxxxx”); 
    adView.loadAd(adRequest); 

    this.mRenderSurfaceView = new RenderSurfaceView(this); 
    mRenderSurfaceView.setRenderer(mEngine, this); 

    final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = 
      new FrameLayout.LayoutParams(super.createSurfaceViewLayoutParams()); 

    frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams); 
    frameLayout.addView(adView, adViewLayoutParams); 

    this.setContentView(frameLayout, frameLayoutLayoutParams); 
} 
+0

logcat은 무엇이라고 말합니까? – William

답변

2

이전 버전의 admob sdk GoogleAdMobAdsSdk-4.1.0에서 비슷한 문제가있었습니다. 그러나 새로운 (적어도) 4.3.1로 이동하면 문제가 해결됩니다. 최신 SDK를 사용해보고 동일한 기능을 실행할 수 있습니까? 도움이되기를 바랍니다.

+2

감사합니다. 저에게 도움이되었습니다. – mfq