Commit 7f56bbe3 by 霍志良

Merge remote-tracking branch 'origin/4.1.54' into 4.1.55

# Conflicts:
#	config.gradle
#	ydl-platform/src/main/java/com/ydl/ydlcommon/utils/actionutil/ActionCountUtils.kt
parents 895152ab d70ecefb
......@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.55",
"ydl-platform" : "0.0.39.56",
//第二步 若干
"ydl-webview" : "0.0.38.32",
......@@ -115,7 +115,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.55",
"ydl-platform" : "0.0.39.56",
//第二步 若干
"ydl-webview" : "0.0.38.31",
......
package com.ydl.ydlcommon.utils.actionutil
//import com.bun.miitmdid.content.ContextKeeper
//import com.ydl.devicesidlib.DemoHelper
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
......@@ -9,7 +7,9 @@ import android.net.wifi.WifiManager
import android.os.Build
import android.text.TextUtils
import android.util.Log
//import com.bun.miitmdid.content.ContextKeeper
import com.google.gson.Gson
//import com.ydl.devicesidlib.DemoHelper
import com.ydl.devicesidlib.DeviceIDHelper
import com.ydl.devicesidlib.Utils
import com.ydl.ydlcommon.base.BaseApp
......@@ -18,7 +18,7 @@ import com.ydl.ydlcommon.data.http.params.ActionDataBean
import com.ydl.ydlcommon.data.http.params.BaiduActionDataBean
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.ActivityManager.Companion.getInstance
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.DeviceTool
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool
......@@ -43,15 +43,17 @@ class ActionCountUtils {
var appId: String = ""
var appName: String = ""
var packageName: String = ""
/**
* appId:消息端来源 - ydl:ydl-app-android-user、xlzx:ydl-app-android-xlzx
* appName:应用名称 - "心理咨询" else "壹点灵心理咨询"
*/
fun init(id:String,name:String){
fun init(id: String, name: String) {
packageName = BaseApp.instance.packageName
appId = id
appName = name
}
/**
* BI埋点封装方法
* 传入埋点事件名称 格式:xxx|xxx
......@@ -133,8 +135,21 @@ class ActionCountUtils {
actionDataParams.os(BIConstants.OS)
actionDataParams.osVersion(android.os.Build.VERSION.RELEASE)
actionDataParams.wifi(if (isWifi()) 0 else 1)
val deviceId =
var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
actionDataParams.deviceId(deviceId)
signs == null ?: signs.forEachIndexed { index, s ->
//拓展参数个数确定,暂不使用反射调用
......@@ -208,17 +223,15 @@ class ActionCountUtils {
val baiduActionDataParams = BaiduActionDataBean.Builder()
baiduActionDataParams.pkname = packageName
baiduActionDataParams.deviceType = 2
var deviceId =""
var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
*序列号对于小米手机Utils.getIMEI(context)
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
val topTaskActivity =
getInstance()
.getTopTaskActivity()
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
//获取imei
Utils.getIMEI(topTaskActivity)
} else {
......@@ -354,7 +367,8 @@ class ActionCountUtils {
private fun isWifi(): Boolean {
try {
var connectivityManager: ConnectivityManager =
RxTool.getContext().getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
RxTool.getContext()
.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
var info: NetworkInfo = connectivityManager.activeNetworkInfo
if (info != null && info.type == ConnectivityManager.TYPE_WIFI) {
return true
......
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