Commit f62e8d62 by YKai

feat: 埋点工具重新封装

parent 871e8507
......@@ -21,6 +21,7 @@ import android.util.Log;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.BuildConfig;
import com.ydl.ydlcommon.base.BaseApp;
import com.yidianling.common.tools.RxTool;
import java.io.BufferedReader;
......@@ -119,28 +120,20 @@ public class DeviceTool {
*
* @return
*/
@SuppressLint("MissingPermission")
public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (!checkHasAgreeSecret()) {
return "";
}
@SuppressLint({"MissingPermission", "HardwareIds"})
public static String getIMEI() {
try {
String imei = "";
RxPermissions rxPermissions = new RxPermissions(topTaskActivity);
if (rxPermissions.isGranted(Manifest.permission.READ_PHONE_STATE)) {
//实例化TelephonyManager对象
TelephonyManager telephonyManager = (TelephonyManager) topTaskActivity.getSystemService(Context.TELEPHONY_SERVICE);
if (null == telephonyManager) {
return "";
}
//获取IMEI号
imei = telephonyManager.getDeviceId();
String imei;
//实例化TelephonyManager对象
TelephonyManager telephonyManager = (TelephonyManager) BaseApp.instance.getSystemService(Context.TELEPHONY_SERVICE);
if (null == telephonyManager) {
return "";
}
//获取IMEI号
imei = telephonyManager.getDeviceId();
if (imei == null) {
return "";
}
if (imei == null) {
return "";
}
return RxTool.Md5(imei);
} catch (Exception e) {
......
......@@ -7,11 +7,11 @@ import android.net.NetworkInfo
import android.net.wifi.WifiManager
import android.os.Build
import com.umeng.commonsdk.UMConfigure
import com.ydl.devicesidlib.Utils
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import com.ydl.ydlcommon.data.http.params.ActionDataBean
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.DeviceTool
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxTool
......@@ -110,7 +110,7 @@ class ActionCountUtils {
actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp()))
val deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
//获取imei
Utils.getIMEI(BaseApp.instance)
DeviceTool.getIMEI()
} else {
//android Q及以上取oaid
oaId
......
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