76 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| package com.novelbook.android.AD.toutiao;
 | ||
| 
 | ||
| /*import android.content.Context;
 | ||
| import android.text.TextUtils;
 | ||
| import android.util.Log;
 | ||
| 
 | ||
| import com.bytedance.sdk.openadsdk.TTAdConfig;
 | ||
| import com.bytedance.sdk.openadsdk.TTAdConstant;
 | ||
| import com.bytedance.sdk.openadsdk.TTAdManager;
 | ||
| import com.bytedance.sdk.openadsdk.TTAdSdk;
 | ||
| import com.novelbook.android.BuildConfig;
 | ||
| import com.novelbook.android.utils.Constants;
 | ||
| 
 | ||
| import static com.novelbook.android.bean.AdSetting.getAppID;*/
 | ||
| 
 | ||
| import android.content.Context;
 | ||
| 
 | ||
| /**
 | ||
|  * 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
 | ||
|  */
 | ||
| public class TTAdManagerHolder {
 | ||
|     //step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
 | ||
|     private static void doInit(Context context) {
 | ||
|       /*  if (!sInit) {
 | ||
|             TTAdSdk.init(context, buildConfig(context));
 | ||
|             sInit = true;
 | ||
|         }*/
 | ||
|     }
 | ||
|     public static void init(Context context) {
 | ||
|        /* if( Constants.AD_SETTING.isShowAdsense() &&
 | ||
|                 !TextUtils.isEmpty(getAppID(Constants.AD_TOUTIAO)) ) {
 | ||
|             doInit(context);
 | ||
|         }*/
 | ||
|     }
 | ||
| /*
 | ||
|     private static boolean sInit;
 | ||
| 
 | ||
|     public static TTAdManager get() {
 | ||
|         if (!sInit) {
 | ||
|             throw new RuntimeException("TTAdSdk is not init, please check.");
 | ||
|         }
 | ||
|         return TTAdSdk.getAdManager();
 | ||
|     }
 | ||
| 
 | ||
|     public static void init(Context context) {
 | ||
|         if( Constants.AD_SETTING.isShowAdsense() &&
 | ||
|                 !TextUtils.isEmpty(getAppID(Constants.AD_TOUTIAO)) ) {
 | ||
|             doInit(context);
 | ||
|         }
 | ||
|     }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|     private static TTAdConfig buildConfig(Context context) {
 | ||
| 
 | ||
|         Log.d("adinit", "buildConfig:Constants.SEX= "+Constants.SEX );
 | ||
|         return new TTAdConfig.Builder()
 | ||
|                 .appId(getAppID(Constants.AD_TOUTIAO))
 | ||
|                 .useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
 | ||
|                 .appName("如意小说")
 | ||
|                 .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
 | ||
|                 .allowShowNotify(true) //是否允许sdk展示通知栏提示
 | ||
|                 .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
 | ||
|                // .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
 | ||
|                 .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_4G) //允许直接下载的网络状态集合
 | ||
|                 .supportMultiProcess(false) //是否支持多进程,true支持
 | ||
|                 .gender(Constants.SEX==1 ? TTAdConstant.GENDER_MALE : TTAdConstant.GENDER_FEMALE) // TTAdConstant.GENDER_UNKNOWN)
 | ||
|                 // .age(20) //TODO: 年龄收集
 | ||
|                 .build();
 | ||
| 
 | ||
|     }*/
 | ||
|     public static void initOnSexChange(Context context){
 | ||
|       //  buildConfig(context);
 | ||
|     }
 | ||
| }
 |