Commit 9557d6d2 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 6cd1ff82
......@@ -55,7 +55,7 @@ public class ReadToutiaoAD {
private void initFeedAD(OnAdViewReceiver receiver, int width, int height, OnClickListener clickListener) {
//设置广告参数
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD) //广告位id
.setCodeId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_READ) //广告位id
.setSupportDeepLink(true)
.setAdCount(1) //请求广告数量为1到3条
.setExpressViewAcceptedSize(width, height) //必填:期望个性化模板广告view的size,单位dp
......
......@@ -29,7 +29,7 @@ public class ReadYlhAd {
}
private void initVedioAD(final Context context, OnAdViewReceiver receiver) {
rewardVideoAD = new RewardVideoAD(context, YlhAdManager.INSTANCE.getYLH_AD_VEDIO_DRINK_POSTID(), new RewardVideoADListener() {
rewardVideoAD = new RewardVideoAD(context, YlhAdManager.INSTANCE.getYLH_AD_VEDIO_READER_POSTID(), new RewardVideoADListener() {
@Override
public void onADLoad() {//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
receiver.onReceive(true, null);
......
......@@ -47,6 +47,7 @@ public class TtCsjAdManager {
/*全屏视频*/
public static String TT_AD_FULLVEDIO_ALL = "945752969";// 通用
/*信息流*/
public static String TT_AD_NATIVEEXPRESS_READ = "946010585";//听读
public static String TT_AD_NATIVEEXPRESS_XMLY = "945700753";//喜马拉雅信息流
public static String TT_AD_NATIVEEXPRESS_AWARD = "945562047";//信息流弹窗
public static String TT_AD_NATIVEEXPRESS_WALK = "945562698";//走路
......
......@@ -29,6 +29,7 @@ object YlhAdManager {
var YLH_AD_VEDIO_MOREDIALOG_POSTID = "9001346780383626" //气泡
var YLH_AD_VEDIO_SIGN_POSTID = "9001346780383626" //签到
var YLH_AD_VEDIO_OFFINELINE_POSTID = "9001346780383626" //离线弹框
var YLH_AD_VEDIO_READER_POSTID = "7051178727922752" //听读
var YLH_AD_VEDIO_GAME_POSTID = "9051646750686770" //猎豹游戏
var YLH_AD_VEDIO_JULEYUN_POSTID = "1011746770898338" //聚乐云
......
......@@ -16,44 +16,44 @@ import java.net.URLEncoder;
*/
public class PhoneParameterUtils {
/**
* 获取MAC地址
*
* @return
*/
public static String getMacAddress(Application application) {
WifiManager manager = (WifiManager) application.getSystemService(Context.WIFI_SERVICE);
String MacAddress = "";
if (manager != null) {
MacAddress = manager.getConnectionInfo().getMacAddress();
}
return MacAddress;
}
/**
* 返回用户手机运营商名称 * @param telephonyManager * @return
*/
public static String getProvidersName(Application loanApplication) {
String ProvidersName = null;
try {
TelephonyManager telephonyManager = (TelephonyManager) loanApplication.getSystemService(Context.TELEPHONY_SERVICE);
String IMSI; // 返回唯一的用户ID;就是这张卡的编号神马的
IMSI = telephonyManager.getSubscriberId();
if (IMSI == null)
return "unkwon";
// IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。其中
if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
ProvidersName = "中国移动";
} else if (IMSI.startsWith("46001")) {
ProvidersName = "中国联通";
} else if (IMSI.startsWith("46003")) {
ProvidersName = "中国电信";
}
ProvidersName = URLEncoder.encode("" + ProvidersName, "UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
return ProvidersName;
}
// /**
// * 获取MAC地址
// *
// * @return
// */
// public static String getMacAddress(Application application) {
// WifiManager manager = (WifiManager) application.getSystemService(Context.WIFI_SERVICE);
// String MacAddress = "";
// if (manager != null) {
// MacAddress = manager.getConnectionInfo().getMacAddress();
// }
// return MacAddress;
// }
//
// /**
// * 返回用户手机运营商名称 * @param telephonyManager * @return
// */
// public static String getProvidersName(Application loanApplication) {
// String ProvidersName = null;
// try {
// TelephonyManager telephonyManager = (TelephonyManager) loanApplication.getSystemService(Context.TELEPHONY_SERVICE);
// String IMSI; // 返回唯一的用户ID;就是这张卡的编号神马的
// IMSI = telephonyManager.getSubscriberId();
// if (IMSI == null)
// return "unkwon";
// // IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信。其中
// if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
// ProvidersName = "中国移动";
// } else if (IMSI.startsWith("46001")) {
// ProvidersName = "中国联通";
// } else if (IMSI.startsWith("46003")) {
// ProvidersName = "中国电信";
// }
// ProvidersName = URLEncoder.encode("" + ProvidersName, "UTF-8");
// } catch (UnsupportedEncodingException e) {
// // TODO Auto-generated catch block e.printStackTrace();
// }
// return ProvidersName;
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment