Commit 9b982cce authored by xujialang's avatar xujialang

Merge remote-tracking branch 'origin/master'

parents a1789d7b fe9b25b0
......@@ -52,6 +52,9 @@ public final class OutHelp implements KPListener {
private boolean isDebug = false;
private String sdkName = null;
private String dexVersionName = null;
private String dexVersionCode = null;
private String activityName = null;
//是否第一次轮询
......@@ -66,22 +69,17 @@ public final class OutHelp implements KPListener {
* @param isDebug appId
* @param isDebug appKey
*/
public void init(Context context, boolean isDebug, String appId, String appKey, String sdkName, String nameInterfacePath, String activityName) {
public void init(Context context, boolean isDebug, String appId, String appKey, String sdkName, String nameInterfacePath, String activityName,
String dexVersionName, String dexVersionCode) {
this.mContext = context;
this.isDebug = isDebug;
this.sdkName = sdkName;
this.activityName = activityName;
this.dexVersionName = dexVersionName;
this.dexVersionCode = dexVersionCode;
LogUtil.addObserver(new LogToLogcat());
if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启");
Statistics.getInstance().onEvent(context, "out_close");
return;
} else {
Statistics.getInstance().onEvent(context, "out_open");
}
LogUtil.d(TAG + "初始化 isDebug=" + isDebug);
LogUtil.d(TAG + "初始化 appId=" + appId);
LogUtil.d(TAG + "初始化 appKey=" + appKey);
......@@ -119,10 +117,11 @@ public final class OutHelp implements KPListener {
@Override
public void run() {
if (!DataManager.get().checkOutOpen(mContext)) {
Statistics.getInstance().dotEvent("out_close");
LogUtil.d(TAG + "外展未开启,不轮询检测");
return;
}
Statistics.getInstance().dotEvent("out_open");
LogUtil.d(TAG, "firstLx : " + firstLx);
showOutAd(firstLx);
......@@ -192,6 +191,13 @@ public final class OutHelp implements KPListener {
return activityName;
}
public String getDexVersionName() {
return dexVersionName;
}
public String getDexVersionCode() {
return dexVersionCode;
}
public void clearNotification() {
try {
......@@ -439,11 +445,6 @@ public final class OutHelp implements KPListener {
public static class TriggerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启,不接收广播");
return;
}
if (intent == null) {
return;
}
......@@ -451,6 +452,12 @@ public final class OutHelp implements KPListener {
switch (action) {
case Intent.ACTION_USER_PRESENT: {
LogUtil.d(TAG + "===>>> 解锁");
if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启,不接收广播");
Statistics.getInstance().dotEvent("out_close");
return;
}
Statistics.getInstance().dotEvent("out_open");
OutHelp.get().showOutAd(ActionFrom.ACTION_USER_PRESENT);
break;
}
......
......@@ -10,6 +10,7 @@ import com.google.gson.Gson;
import com.zl.sdk.bean.IconOpt;
import com.zl.sdk.bean.OutAdData;
import com.zl.sdk.bean.OutConfig;
import com.zl.sdk.event.statistics.Utils;
import com.zl.sdk.util.LogUtil;
import com.zl.sdk.util.SPUtils;
......@@ -183,6 +184,11 @@ public class DataManager {
public boolean checkOutOpen(Context context) {
int versionCode = Utils.getAppVersionCode(context);
LogUtil.d(TAG + "versionCode = " + versionCode);
if (versionCode <= 22) { // app versionCode低于23,没有带开关功能,自动打开
return true;
}
return SPUtils.getInstance(context, CONFIG_SP).getInt(OUT_OPEN, 0) == 1;
}
}
......@@ -3,6 +3,7 @@ package com.zl.sdk.event.statistics;
import android.content.Context;
import com.or.ange.dot.UsageStats;
import com.zl.sdk.OutHelp;
import java.util.HashMap;
import java.util.Map;
......@@ -31,12 +32,21 @@ class DotOperator extends AbsStatistics {
@Override
public void onEvent(Context context, String eventId) {
UsageStats.onEvent(eventId);
try {
Map<String, String> map = new HashMap<>();
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, map);
} catch (Exception e) {
}
}
@Override
public void onEvent(Context context, String eventId, String eventLabel) {
try {
Map<String, String> map = new HashMap<>();
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, eventLabel);
} catch (Exception e) {
}
......@@ -61,6 +71,8 @@ class DotOperator extends AbsStatistics {
}
}
try {
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, eventLabel, map);
} catch (Exception e) {
}
......@@ -85,6 +97,8 @@ class DotOperator extends AbsStatistics {
}
}
try {
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, eventLabel, map);
} catch (Exception e) {
}
......@@ -105,6 +119,8 @@ class DotOperator extends AbsStatistics {
}
}
try {
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, map);
} catch (Exception e) {
}
......@@ -113,7 +129,10 @@ class DotOperator extends AbsStatistics {
@Override
public void dotEvent(String eventId) {
try {
UsageStats.onEvent(eventId);
Map<String, String> map = new HashMap<>();
map.put("ver_name", OutHelp.get().getDexVersionName());
map.put("ver_code", OutHelp.get().getDexVersionCode());
UsageStats.onEvent(eventId, map);
} catch (Exception e) {
}
}
......
......@@ -77,10 +77,6 @@ public class IcOptManager {
}
public void init(Context context) {
if (!DataManager.get().checkOutOpen(context)) {
LogUtil.d(TAG + "外展未开启,不初始化IcOptManager");
return;
}
if (isInit) {
return;
......
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