How to implement facebook banner ads in fragment?

﹥>﹥吖頭↗ 提交于 2021-01-29 08:37:40

问题


I am beginner i need to show facebook banner ads in fragment can any one guide how to implement banner ads facebook activity code into fragment?

    public class YourApplication extends Application {

        @Override
        public void onCreate() {
            super.onCreate();

            AudienceNetworkAds.initialize(this);


      adView = new AdView(this, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50);


      LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);


      adContainer.addView(adView);


      adView.loadAd();  

        }

    }


        @Override
    protected void onDestroy() {
      if (adView != null) {
        adView.destroy();
      }
      super.onDestroy();
    }

来源:https://stackoverflow.com/questions/61771142/how-to-implement-facebook-banner-ads-in-fragment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!