Splash广告集成说明

开屏(Splash)

1. 确定AdHubSDK的主SDK文件已经拷贝到工程文件的libs子目录下参考

2. 在需要添加开屏广告的Activity对应的布局文件添加一个ViewGroup来给样式定位

  • 例如:

      <FrameLayout
          android:id="@+id/adsFl"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_above="@id/bottomRl"
          android:background="@android:color/transparent" />
    

3. 添加广告代码,添加广告代码前请确定已初始化SDK

  • 例如:
        // adUnitContainer
    FrameLayout adsParent = (FrameLayout) this.findViewById(R.id.adsFl);

    SplashAd splashAd = new SplashAd(this, adsParent, new AdListener() {
        @Override
        public void onAdShown() {
            Log.d("lance", "onAdShown");
        }

        @Override
        public void onAdLoaded() {
            Log.d("lance", "onAdLoaded");
        }

        @Override
        public void onAdFailedToLoad(int i) {
            Log.d("lance", "onAdFailedToLoad");
        }

        @Override
        public void onAdClosed() {
            Log.d("lance", "onAdClosed");
        }

        @Override
        public void onAdClicked() {
            Log.d("lance", "onAdClicked");
        }
    }, "adUnitId");

PS:更多设置请参考Demo中的com.hubcloud.adhubsdkdemo.SplashActivity的代码.

results matching ""

    No results matching ""