Commit 77f091c5 authored by mengcuiguang's avatar mengcuiguang

优化优量汇内存泄漏,更换最新api

parent 7096cfc1
...@@ -36,14 +36,13 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -36,14 +36,13 @@ public class YlhVideoAdManager extends BaseVideoAd {
if (_inst != null) { if (_inst != null) {
return _inst; return _inst;
} else { } else {
WeakReference<Activity> activityWeakReference = new WeakReference<>(activity); _inst = new YlhVideoAdManager(activity);
_inst = new YlhVideoAdManager(activityWeakReference);
return _inst; return _inst;
} }
} }
private YlhVideoAdManager(WeakReference<Activity> activity) { private YlhVideoAdManager(Activity activity) {
init(activity.get()); init(activity);
} }
private void init(Activity activity) { private void init(Activity activity) {
...@@ -53,6 +52,7 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -53,6 +52,7 @@ public class YlhVideoAdManager extends BaseVideoAd {
@Override @Override
public void onDestroy() { public void onDestroy() {
activity = null; activity = null;
rewardVideoAD = null;
} }
/** /**
...@@ -132,7 +132,7 @@ public class YlhVideoAdManager extends BaseVideoAd { ...@@ -132,7 +132,7 @@ public class YlhVideoAdManager extends BaseVideoAd {
} }
rewardVideoAD = new RewardVideoAD(activity, YlhAdManager.YLH_AD_APPID, ylhPostId, new RewardVideoADListener() { rewardVideoAD = new RewardVideoAD(activity, ylhPostId, new RewardVideoADListener() {
@Override @Override
public void onADLoad() {//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取 public void onADLoad() {//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
try { try {
......
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