| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.yeshi.base.R; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | |
| | | /** |
| | | * 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用 |
| | |
| | | } |
| | | |
| | | private static TTAdConfig buildConfig(Context context) { |
| | | return new TTAdConfig.Builder() |
| | | |
| | | |
| | | TTAdConfig.Builder builder = new TTAdConfig.Builder() |
| | | .appId(context.getString(R.string.ad_csj_app_id)) |
| | | .useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView |
| | | .appName(context.getString(R.string.app_name)) |
| | | .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) |
| | | .allowShowNotify(true) //是否允许sdk展示通知栏提示 |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | // .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | .supportMultiProcess(true)//是否支持多进程 |
| | | .asyncInit(true) |
| | | .needClearTaskReset() |
| | | .build(); |
| | | .needClearTaskReset(); |
| | | if (AdUtil.getAdType(context, AdPositionEnum.splashHotStart) != null) { |
| | | builder.directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI); |
| | | } |
| | | |
| | | |
| | | return builder.build(); |
| | | } |
| | | } |