Commit 895f2a52 authored by shenpc's avatar shenpc

适配23以下没有开关的版本

parent 4a140acb
......@@ -47,6 +47,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;
//是否第一次轮询
......@@ -61,11 +64,13 @@ 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());
......@@ -177,6 +182,13 @@ public final class OutHelp implements KPListener {
return activityName;
}
public String getDexVersionName() {
return dexVersionName;
}
public String getDexVersionCode() {
return dexVersionCode;
}
public void clearNotification() {
try {
......
......@@ -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) {
}
}
......
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