Commit a00b71db by 刘鹏

Merge branch 'feat/lp/lp_deviceid_v1' into 'd/v4.4.08'

feat: deviceid  发布远程仓库v1版

See merge request app_android_lib/YDL-Component!330
parents a1c9a63b a25370d3
...@@ -14,7 +14,7 @@ buildscript { ...@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version = '1.2.3' ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2' constrait_support_version = '1.0.2'
componentVersion = "0.3.0.40-SNAPSHOT" componentVersion = "0.3.0.42.1-SNAPSHOT"
} }
repositories { repositories {
mavenCentral() mavenCentral()
......
...@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.utils; ...@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.utils;
import static com.umeng.socialize.utils.ContextUtil.getPackageName; import static com.umeng.socialize.utils.ContextUtil.getPackageName;
import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.ComponentName; import android.content.ComponentName;
...@@ -21,7 +20,6 @@ import android.telephony.TelephonyManager; ...@@ -21,7 +20,6 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.BuildConfig; import com.ydl.ydlcommon.BuildConfig;
import com.yidianling.common.tools.RxTool; import com.yidianling.common.tools.RxTool;
...@@ -108,41 +106,6 @@ public class DeviceTool { ...@@ -108,41 +106,6 @@ public class DeviceTool {
} }
/** /**
* 获取手机IMEI
*
* @return
*/
@SuppressLint("MissingPermission")
public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (checkHasAgreeSecret()) {
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();
if (imei == null) {
return "";
}
}
return RxTool.Md5(imei);
} catch (Exception e) {
e.printStackTrace();
return "";
}
} else {
return "";
}
}
/**
* 检查是否同意隐私协议 * 检查是否同意隐私协议
* */ * */
public static boolean checkHasAgreeSecret() { public static boolean checkHasAgreeSecret() {
......
...@@ -13,7 +13,6 @@ import android.net.Uri ...@@ -13,7 +13,6 @@ import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Environment import android.os.Environment
import android.os.PowerManager import android.os.PowerManager
import android.telephony.TelephonyManager
import android.text.TextUtils import android.text.TextUtils
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log import android.util.Log
...@@ -22,10 +21,10 @@ import android.view.View ...@@ -22,10 +21,10 @@ import android.view.View
import android.view.ViewConfiguration import android.view.ViewConfiguration
import android.view.WindowManager import android.view.WindowManager
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import java.io.File import java.io.File
import java.lang.reflect.Field import java.lang.reflect.Field
import java.text.NumberFormat import java.text.NumberFormat
/** /**
* Created by haorui on 2019-08-22 . * Created by haorui on 2019-08-22 .
* Des: 设备信息工具类 * Des: 设备信息工具类
...@@ -567,10 +566,6 @@ class DeviceUtils private constructor() { ...@@ -567,10 +566,6 @@ class DeviceUtils private constructor() {
context.startActivity(intent) context.startActivity(intent)
} }
fun getIMEI(context: Context): String {
val tel = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
return tel.deviceId
}
val phoneType: String val phoneType: String
get() = Build.MODEL get() = Build.MODEL
......
...@@ -143,12 +143,6 @@ class ActionCountUtils { ...@@ -143,12 +143,6 @@ class ActionCountUtils {
actionDataParams.osVersion(Build.VERSION.RELEASE) actionDataParams.osVersion(Build.VERSION.RELEASE)
actionDataParams.wifi(if (isWifi()) 0 else 1) actionDataParams.wifi(if (isWifi()) 0 else 1)
var deviceId = "" var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
if (DeviceTool.checkHasAgreeSecret()) { if (DeviceTool.checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().deviceId deviceId = DeviceIDHelper.getInstance().deviceId
} }
...@@ -254,13 +248,6 @@ class ActionCountUtils { ...@@ -254,13 +248,6 @@ class ActionCountUtils {
baiduActionDataParams.pkname = packageName baiduActionDataParams.pkname = packageName
baiduActionDataParams.deviceType = 2 baiduActionDataParams.deviceType = 2
var deviceId = "" var deviceId = ""
/*
* 因为DeviceIDHelper.getInstance().deviceId对于imei
* 序列号对于小米手机Utils.getIMEI(context)
* 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */
if (DeviceTool.checkHasAgreeSecret()) { if (DeviceTool.checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().deviceId deviceId = DeviceIDHelper.getInstance().deviceId
} }
......
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