admin
2020-10-21 dccccf0760a792262e2f20fe7cfbc8fbb0ada98f
BuWanVideo/src/com/weikou/beibeivideo/util/ad/AdUtil.java
@@ -27,6 +27,7 @@
    public final static String POSITION_SPLASH = "splash";//开屏
    public final static String POSITION_VIDEO_PLAY_PRE = "videoPlayPre";//视频播放前贴
    public final static String POSITION_EXIT_APP = "exitApp";//APP退出广告
    public final static String POSITION_SEARCH = "videoSearch";//搜索页广告
    public static AD_TYPE getSmallExpressAdType() {
        if (BeibeiConstant.AD_TYPE != null && AdTypeVO.TYPE_CSJ.equalsIgnoreCase(BeibeiConstant.AD_TYPE.getExpressSmallType())) {
@@ -70,7 +71,9 @@
        if (!StringUtils.isNullOrEmpty(config)) {//万一没设置起就用广点通
            try {
                JSONObject object = new JSONObject(config);
                return AD_TYPE.valueOf(object.optString(positionName));
                object = object.optJSONObject(positionName);
                if (object != null)
                    return AD_TYPE.valueOf(object.optString("type"));
            } catch (JSONException e) {
                e.printStackTrace();
            } catch (Exception e1) {
@@ -82,5 +85,25 @@
        return null;
    }
    public static String getAdPid(Context context, String positionName) {
        SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE);
        String config = share.getString("config", "");
        if (!StringUtils.isNullOrEmpty(config)) {//万一没设置起就用广点通
            try {
                JSONObject object = new JSONObject(config);
                object = object.optJSONObject(positionName);
                if (object != null)
                    return object.optString("pid");
            } catch (JSONException e) {
                e.printStackTrace();
            } catch (Exception e1) {
                return null;
            }
        } else {
            return null;
        }
        return null;
    }
}