Commit 124a2e0a by 刘鹏

Merge branch 'fix/lp/lp_fix_ffrom_hg' into 'release'

feat: 合规整改、新ffrom支持

See merge request app_android_lib/YDL-Component!187
parents 21405993 dc2117e2
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.55", "m-user" : "0.0.62.55",
"m-home" : "0.0.23.95", "m-home" : "0.0.23.95",
"m-im" : "0.0.21.60", "m-im" : "0.0.21.61",
"m-dynamic" : "0.0.7.74", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
"m-muse" : "0.0.28.81", "m-muse" : "0.0.28.81",
...@@ -23,12 +23,12 @@ ext { ...@@ -23,12 +23,12 @@ ext {
//mdt 组件 //mdt 组件
"ydl-tuicore" : "0.0.25", "ydl-tuicore" : "0.0.25",
//第一步 //第一步
"ydl-platform" : "0.0.41.41", "ydl-platform" : "0.0.41.44",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.94", "ydl-webview" : "0.0.38.94",
"ydl-media" : "0.0.21.52", "ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.21",
"m-audioim" : "0.0.49.30.23", "m-audioim" : "0.0.49.30.23",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
...@@ -36,7 +36,7 @@ ext { ...@@ -36,7 +36,7 @@ ext {
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.94", "ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.8", "ydl-utils" : "0.0.3.12",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
...@@ -96,7 +96,7 @@ ext { ...@@ -96,7 +96,7 @@ ext {
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.55", "m-user" : "0.0.62.55",
"m-home" : "0.0.23.95", "m-home" : "0.0.23.95",
"m-im" : "0.0.21.60", "m-im" : "0.0.21.61",
"m-dynamic" : "0.0.7.74", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -110,19 +110,19 @@ ext { ...@@ -110,19 +110,19 @@ ext {
//mdt 组件 //mdt 组件
"ydl-tuicore" : "0.0.25", "ydl-tuicore" : "0.0.25",
//第一步 //第一步
"ydl-platform" : "0.0.41.41", "ydl-platform" : "0.0.41.44",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.94", "ydl-webview" : "0.0.38.94",
"ydl-media" : "0.0.21.52", "ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.21",
"m-audioim" : "0.0.49.30.23", "m-audioim" : "0.0.49.30.23",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.94", "ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.8", "ydl-utils" : "0.0.3.12",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
......
...@@ -544,17 +544,13 @@ public class NetworkUtil { ...@@ -544,17 +544,13 @@ public class NetworkUtil {
*/ */
public static String getActiveMacAddress(Context context) { public static String getActiveMacAddress(Context context) {
if (!DeviceTool.checkHasAgreeSecret()) { if (DeviceTool.checkHasAgreeSecret()) {
return ""; WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
} WifiInfo info = wifi.getConnectionInfo();
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (info != null) {
return info.getMacAddress();
WifiInfo info = wifi.getConnectionInfo(); }
if (info != null) {
return info.getMacAddress();
} }
return ""; return "";
} }
......
...@@ -236,7 +236,7 @@ class NimSDKOptionConfig { ...@@ -236,7 +236,7 @@ class NimSDKOptionConfig {
} else { } else {
String appFrom = BaseApp.Companion.getInstance().getGlobalConfig().getAppFrom(); String appFrom = BaseApp.Companion.getInstance().getGlobalConfig().getAppFrom();
if (YDLConstants.FROM_YDL.equals(appFrom)) { if (YDLConstants.FROM_YDL.equals(appFrom) || YDLConstants.FROM_YDL2.equals(appFrom)) {
// 小米推送 // 小米推送
config.xmAppId = "2882303761517432980"; config.xmAppId = "2882303761517432980";
config.xmAppKey = "5241743243980"; config.xmAppKey = "5241743243980";
......
...@@ -18,9 +18,10 @@ public class WxPayParam extends CommonPayParam { ...@@ -18,9 +18,10 @@ public class WxPayParam extends CommonPayParam {
if(!TextUtils.isEmpty(BaseApp.instance.getGlobalConfig().getAppWxPayType())) { if(!TextUtils.isEmpty(BaseApp.instance.getGlobalConfig().getAppWxPayType())) {
type =BaseApp.instance.getGlobalConfig().getAppWxPayType(); type =BaseApp.instance.getGlobalConfig().getAppWxPayType();
}else { }else {
if (YDLConstants.FROM_XLZX.equals(BaseApp.instance.getGlobalConfig().getAppFrom())) { String appFrom = BaseApp.instance.getGlobalConfig().getAppFrom();
if (YDLConstants.FROM_XLZX.equals(appFrom)) {
type = "wxapp_consult"; type = "wxapp_consult";
} else if(YDLConstants.FROM_YDL.equals(BaseApp.instance.getGlobalConfig().getAppFrom())) { } else if (YDLConstants.FROM_YDL.equals(appFrom) || YDLConstants.FROM_YDL2.equals(appFrom)) {
type = "wxapp_hz"; type = "wxapp_hz";
} }
} }
......
...@@ -122,80 +122,12 @@ public class RxDeviceTool { ...@@ -122,80 +122,12 @@ public class RxDeviceTool {
} }
/** /**
* IMEI (唯一标识序列号)
* <p>需与{@link #isPhone(Context)}一起使用</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @param context 上下文
* @return IMEI
*/
// public static String getIMEI(Context context) {
// String deviceId;
// if (isPhone(context)) {
// deviceId = getDeviceIdIMEI(context);
// } else {
// deviceId = getAndroidId(context);
// }
// return deviceId;
// }
/**
* 获取设备的IMSI
*
* @param context
* @return
*/
// public static String getIMSI(Context context) {
// return getSubscriberId(context);
// }
/**
* 获取设备的IMEI
*
* @param context
* @return
*/
// public static String getDeviceIdIMEI(Context context) {
// String id;
// //android.telephony.TelephonyManager
// TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// if (mTelephony.getDeviceId() != null) {
// id = mTelephony.getDeviceId();
// } else {
// //android.provider.Settings;
// id = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
// }
// return id;
// }
/**
* 获取设备的软件版本号
*
* @param context
* @return
*/
// public static String getDeviceSoftwareVersion(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getDeviceSoftwareVersion();
// }
/**
* 获取android系统版本号 * 获取android系统版本号
*/ */
public static String getOsBuileVersion() { public static String getOsBuileVersion() {
return Build.VERSION.RELEASE; return Build.VERSION.RELEASE;
} }
/**
* 获取手机号
*
* @param context
* @return
*/
// public static String getLine1Number(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getLine1Number();
// }
/** /**
* 获取ISO标准的国家码,即国际长途区号 * 获取ISO标准的国家码,即国际长途区号
...@@ -308,28 +240,6 @@ public class RxDeviceTool { ...@@ -308,28 +240,6 @@ public class RxDeviceTool {
} }
/** /**
* 获取唯一的用户ID
*
* @param context
* @return
*/
// public static String getSubscriberId(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getSubscriberId();
// }
/**
* 获取语音邮件号码
*
* @param context
* @return
*/
// public static String getVoiceMailNumber(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getVoiceMailNumber();
// }
/**
* 获取ANDROID ID * 获取ANDROID ID
* *
* @param context * @param context
...@@ -449,66 +359,6 @@ public class RxDeviceTool { ...@@ -449,66 +359,6 @@ public class RxDeviceTool {
return result; return result;
} }
/**
* 获取设备信息
*
* @param context
* @return
*/
// public static String getDeviceInfo(Context context) {
// try {
// org.json.JSONObject json = new org.json.JSONObject();
// TelephonyManager tm = (TelephonyManager) context
// .getSystemService(Context.TELEPHONY_SERVICE);
// String device_id = null;
// if (checkPermission(context, Manifest.permission.READ_PHONE_STATE)) {
// device_id = getDeviceIdIMEI(context);
// }
// String mac = null;
// FileReader fstream = null;
// try {
// fstream = new FileReader("/sys/class/net/wlan0/address");
// } catch (FileNotFoundException e) {
// fstream = new FileReader("/sys/class/net/eth0/address");
// }
// BufferedReader in = null;
// if (fstream != null) {
// try {
// in = new BufferedReader(fstream, 1024);
// mac = in.readLine();
// } catch (IOException e) {
// } finally {
// if (fstream != null) {
// try {
// fstream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (in != null) {
// try {
// in.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
// json.put("mac", mac);
// if (TextUtils.isEmpty(device_id)) {
// device_id = mac;
// }
// if (TextUtils.isEmpty(device_id)) {
// device_id = Settings.Secure.getString(context.getContentResolver(),
// Settings.Secure.ANDROID_ID);
// }
// json.put("device_id", device_id);
// return json.toString();
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
/** /**
......
...@@ -22,9 +22,10 @@ public class WXRechargeIdParam extends BaseCommand { ...@@ -22,9 +22,10 @@ public class WXRechargeIdParam extends BaseCommand {
if(!TextUtils.isEmpty(BaseApp.instance.getGlobalConfig().getAppWxPayType())) { if(!TextUtils.isEmpty(BaseApp.instance.getGlobalConfig().getAppWxPayType())) {
type =BaseApp.instance.getGlobalConfig().getAppWxPayType(); type =BaseApp.instance.getGlobalConfig().getAppWxPayType();
}else { }else {
if (YDLConstants.FROM_XLZX.equals(BaseApp.instance.getGlobalConfig().getAppFrom())) { String appFrom = BaseApp.instance.getGlobalConfig().getAppFrom();
if (YDLConstants.FROM_XLZX.equals(appFrom)) {
type = "wxapp_consult"; type = "wxapp_consult";
} else if(YDLConstants.FROM_YDL.equals(BaseApp.instance.getGlobalConfig().getAppFrom())) { } else if (YDLConstants.FROM_YDL.equals(appFrom) || YDLConstants.FROM_YDL2.equals(appFrom)) {
type = "wxapp_hz"; type = "wxapp_hz";
} }
} }
......
...@@ -6,10 +6,8 @@ import android.os.Build ...@@ -6,10 +6,8 @@ import android.os.Build
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.bun.miitmdid.core.JLibrary import com.bun.miitmdid.core.JLibrary
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import com.ydl.devicesidlib.DeviceIDHelper
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.UpLoadLogUtils import com.ydl.ydlcommon.data.http.UpLoadLogUtils
import com.ydl.ydlcommon.utils.AppProgressUtils
import com.ydl.ydlcommon.utils.BuryPointUtils import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.LogUtil import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
......
...@@ -17,10 +17,12 @@ object YDLConstants { ...@@ -17,10 +17,12 @@ object YDLConstants {
const val BUNDLE = "bundle" const val BUNDLE = "bundle"
const val FROM_YDL = "android" const val FROM_YDL = "android"
//壹点灵sem渠道ffrom
const val FROM_YDL2 = "BaiduSem"
const val FROM_XLZX = "ATK_7_android" const val FROM_XLZX = "ATK_7_android"
//自定义注解,限制入参类型 //自定义注解,限制入参类型
@StringDef(FROM_YDL, FROM_XLZX) @StringDef(FROM_YDL, FROM_XLZX, FROM_YDL2)
annotation class AppFrom annotation class AppFrom
......
...@@ -5,7 +5,6 @@ import android.util.Log; ...@@ -5,7 +5,6 @@ import android.util.Log;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import com.ydl.burypointlib.BuryPointHelper; import com.ydl.burypointlib.BuryPointHelper;
//import com.ydl.devicesidlib.DemoHelper;
import com.ydl.devicesidlib.DeviceIDHelper; import com.ydl.devicesidlib.DeviceIDHelper;
import com.ydl.pushserver.pushagent.YdlPushAgent; import com.ydl.pushserver.pushagent.YdlPushAgent;
import com.ydl.pushserver.pushagent.common.listener.IYDLPushListener; import com.ydl.pushserver.pushagent.common.listener.IYDLPushListener;
...@@ -18,6 +17,8 @@ import com.yidianling.common.tools.RxAppTool; ...@@ -18,6 +17,8 @@ import com.yidianling.common.tools.RxAppTool;
import com.yidianling.common.tools.RxDeviceTool; import com.yidianling.common.tools.RxDeviceTool;
import com.yidianling.common.tools.RxNetTool; import com.yidianling.common.tools.RxNetTool;
import static com.ydl.ydlcommon.utils.DeviceTool.checkHasAgreeSecret;
//import static com.bun.miitmdid.content.ContextKeeper.getApplicationContext; //import static com.bun.miitmdid.content.ContextKeeper.getApplicationContext;
//import com.ydl.burypointlib.BuryPointHelper; //import com.ydl.burypointlib.BuryPointHelper;
...@@ -43,7 +44,10 @@ public class YdlBuryPointUtil { ...@@ -43,7 +44,10 @@ public class YdlBuryPointUtil {
RegisterEventBean registerEventBean = new RegisterEventBean(); RegisterEventBean registerEventBean = new RegisterEventBean();
registerEventBean.setAppId(context.getPackageName()); registerEventBean.setAppId(context.getPackageName());
registerEventBean.setAppVersion(RxAppTool.getAppVersionName(context)); registerEventBean.setAppVersion(RxAppTool.getAppVersionName(context));
String deviceId = DeviceIDHelper.getInstance().getDeviceId(); String deviceId = "";
if (checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().getDeviceId();
}
registerEventBean.setDeviceId(deviceId); registerEventBean.setDeviceId(deviceId);
registerEventBean.setManufacturer(RxDeviceTool.getBuildMANUFACTURER()); registerEventBean.setManufacturer(RxDeviceTool.getBuildMANUFACTURER());
registerEventBean.setChannel(YdlCommonOut.Companion.getChannelName()); registerEventBean.setChannel(YdlCommonOut.Companion.getChannelName());
...@@ -92,7 +96,10 @@ public class YdlBuryPointUtil { ...@@ -92,7 +96,10 @@ public class YdlBuryPointUtil {
RegisterEventBean registerEventBean = new RegisterEventBean(); RegisterEventBean registerEventBean = new RegisterEventBean();
registerEventBean.setAppId(context.getPackageName()); registerEventBean.setAppId(context.getPackageName());
registerEventBean.setAppVersion(RxAppTool.getAppVersionName(context)); registerEventBean.setAppVersion(RxAppTool.getAppVersionName(context));
String deviceId = DeviceIDHelper.getInstance().getDeviceId(); String deviceId ="";
if (checkHasAgreeSecret()) {
deviceId = DeviceIDHelper.getInstance().getDeviceId();
}
registerEventBean.setDeviceId(deviceId); registerEventBean.setDeviceId(deviceId);
registerEventBean.setManufacturer(RxDeviceTool.getBuildMANUFACTURER()); registerEventBean.setManufacturer(RxDeviceTool.getBuildMANUFACTURER());
registerEventBean.setChannel(YdlCommonOut.Companion.getChannelName()); registerEventBean.setChannel(YdlCommonOut.Companion.getChannelName());
......
...@@ -151,14 +151,17 @@ class ActionCountUtils { ...@@ -151,14 +151,17 @@ class ActionCountUtils {
* 第一次安装获取失败,第二次打开就能成功 * 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题 * 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */ * */
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { if (DeviceTool.checkHasAgreeSecret()){
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity() deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
//获取imei val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
Utils.getIMEI(topTaskActivity) //获取imei
} else { Utils.getIMEI(topTaskActivity)
//android Q及以上取oaid } else {
DeviceIDHelper.getInstance().deviceId //android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
} }
actionDataParams.deviceId(deviceId) actionDataParams.deviceId(deviceId)
signs.forEachIndexed { index, s -> signs.forEachIndexed { index, s ->
//拓展参数个数确定,暂不使用反射调用 //拓展参数个数确定,暂不使用反射调用
...@@ -266,14 +269,18 @@ class ActionCountUtils { ...@@ -266,14 +269,18 @@ class ActionCountUtils {
* 第一次安装获取失败,第二次打开就能成功 * 第一次安装获取失败,第二次打开就能成功
* 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题 * 所以Utils.getIMEI(topTaskActivity)传入activity解决这个问题
* */ * */
deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity() if (DeviceTool.checkHasAgreeSecret()){
//获取imei deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
Utils.getIMEI(topTaskActivity) val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
} else { //获取imei
//android Q及以上取oaid Utils.getIMEI(topTaskActivity)
DeviceIDHelper.getInstance().deviceId } else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
} }
baiduActionDataParams.deviceId(deviceId) baiduActionDataParams.deviceId(deviceId)
baiduActionDataParams.convertType(convertType) baiduActionDataParams.convertType(convertType)
baiduActionDataParams.convertTime(System.currentTimeMillis() / 1000) baiduActionDataParams.convertTime(System.currentTimeMillis() / 1000)
...@@ -342,14 +349,18 @@ class ActionCountUtils { ...@@ -342,14 +349,18 @@ class ActionCountUtils {
actionDataParams.sign2 = sign2 actionDataParams.sign2 = sign2
actionDataParams.api = api actionDataParams.api = api
actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp())) actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp()))
val deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { var deviceId = ""
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity() if (DeviceTool.checkHasAgreeSecret()){
//获取imei deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
Utils.getIMEI(topTaskActivity) val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
} else { //获取imei
//android Q及以上取oaid Utils.getIMEI(topTaskActivity)
DeviceIDHelper.getInstance().deviceId } else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
} }
actionDataParams.deviceId=deviceId actionDataParams.deviceId=deviceId
actionDataParams.time(System.currentTimeMillis()) actionDataParams.time(System.currentTimeMillis())
...@@ -388,15 +399,18 @@ class ActionCountUtils { ...@@ -388,15 +399,18 @@ class ActionCountUtils {
actionDataParams.sign2 = sign2 actionDataParams.sign2 = sign2
actionDataParams.sign3 = sign3 actionDataParams.sign3 = sign3
actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp())) actionDataParams.appVersion(RxDeviceTool.getAppVersionName(BaseApp.getApp()))
val deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { var deviceId = ""
val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity() if (DeviceTool.checkHasAgreeSecret()) {
//获取imei deviceId = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
Utils.getIMEI(topTaskActivity) val topTaskActivity = ActivityManager.getInstance().getTopTaskActivity()
} else { //获取imei
//android Q及以上取oaid Utils.getIMEI(topTaskActivity)
DeviceIDHelper.getInstance().deviceId } else {
//android Q及以上取oaid
DeviceIDHelper.getInstance().deviceId
}
} }
actionDataParams.deviceId=deviceId actionDataParams.deviceId = deviceId
actionDataParams.time(System.currentTimeMillis()) actionDataParams.time(System.currentTimeMillis())
actionDataParams.appId(appId) actionDataParams.appId(appId)
...@@ -434,22 +448,21 @@ class ActionCountUtils { ...@@ -434,22 +448,21 @@ class ActionCountUtils {
* @return * @return
*/ */
fun getIpAddress(context: Context): String { fun getIpAddress(context: Context): String {
if (DeviceTool.checkHasAgreeSecret()) {
if (!DeviceTool.checkHasAgreeSecret()) { // 获取WiFi服务
return "" val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager
} // 判断WiFi是否开启
// 获取WiFi服务 if (wifiManager.isWifiEnabled) {
val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager // 已经开启了WiFi
// 判断WiFi是否开启 val wifiInfo = wifiManager.connectionInfo
if (wifiManager.isWifiEnabled) { val ipAddress = wifiInfo.ipAddress
// 已经开启了WiFi return intToIp(ipAddress)
val wifiInfo = wifiManager.connectionInfo } else {
val ipAddress = wifiInfo.ipAddress // 未开启WiFi
return intToIp(ipAddress) return getIpAddress()
} else { }
// 未开启WiFi
return getIpAddress()
} }
return ""
} }
private fun intToIp(ipAddress: Int): String { private fun intToIp(ipAddress: Int): String {
......
...@@ -161,64 +161,6 @@ public class RxDeviceTool { ...@@ -161,64 +161,6 @@ public class RxDeviceTool {
} }
/** /**
* IMEI (唯一标识序列号)
* <p>需与{@link #isPhone(Context)}一起使用</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @param context 上下文
* @return IMEI
*/
// public static String getIMEI(Context context) {
// String deviceId;
// if (isPhone(context)) {
// deviceId = getDeviceIdIMEI(context);
// } else {
// deviceId = getAndroidId(context);
// }
// return deviceId;
// }
/**
* 获取设备的IMSI
*
* @param context
* @return
*/
// public static String getIMSI(Context context) {
// return getSubscriberId(context);
// }
/**
* 获取设备的IMEI
*
* @param context
* @return
*/
// public static String getDeviceIdIMEI(Context context) {
// String id;
// //android.telephony.TelephonyManager
// TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// if (mTelephony.getDeviceId() != null) {
// id = mTelephony.getDeviceId();
// } else {
// //android.provider.Settings;
// id = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
// }
// return id;
// }
/**
* 获取设备的软件版本号
*
* @param context
* @return
*/
// public static String getDeviceSoftwareVersion(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getDeviceSoftwareVersion();
// }
/**
* 获取android系统版本号 * 获取android系统版本号
*/ */
public static String getOsBuileVersion(){ public static String getOsBuileVersion(){
...@@ -226,17 +168,6 @@ public class RxDeviceTool { ...@@ -226,17 +168,6 @@ public class RxDeviceTool {
} }
/** /**
* 获取手机号
*
* @param context
* @return
*/
// public static String getLine1Number(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getLine1Number();
// }
/**
* 获取ISO标准的国家码,即国际长途区号 * 获取ISO标准的国家码,即国际长途区号
* *
* @param context * @param context
......
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