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