[dev_arch_opt_3.0]
[Change] [ 1、优化获取设备SN标志,设备序列号>AndroidID>随机ID ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.api.V2XApiService
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.body.V2XRefreshEntity
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.utils.DeviceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -64,7 +64,7 @@ internal class V2XRefreshModel {
|
||||
handled
|
||||
})
|
||||
this["netType"] = CommonUtils.getNetworkType(config.context)
|
||||
this["cellId"] = DeviceUtils.getCellId(config.context) ?: ""
|
||||
this["cellId"] = DeviceUtils.getCellId() ?: ""
|
||||
this["sn"] = config.aiCloudConfig.sn
|
||||
this["ticket"] = config.aiCloudConfig.token
|
||||
this["sig"] = SignUtil.createSign(this, "JGjZx6")
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.utils
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.telephony.CellLocation
|
||||
import android.telephony.TelephonyManager
|
||||
import android.telephony.cdma.CdmaCellLocation
|
||||
import android.telephony.gsm.GsmCellLocation
|
||||
import java.lang.Exception
|
||||
|
||||
internal class DeviceUtils {
|
||||
|
||||
companion object {
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@JvmStatic
|
||||
fun getCellId(context: Context): String? {
|
||||
val tm = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
|
||||
val pm = context.packageManager
|
||||
val accessCoarseLocationPermission = PackageManager.PERMISSION_GRANTED ==
|
||||
pm.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION, context.packageName)
|
||||
val accessFineLocationPermission = PackageManager.PERMISSION_GRANTED ==
|
||||
pm.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, context.packageName)
|
||||
if (!accessCoarseLocationPermission || !accessFineLocationPermission) return "noPermission"
|
||||
var location: CellLocation? = null
|
||||
try {
|
||||
location = tm.cellLocation
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (location != null) {
|
||||
// Gsm网络 , 联通移动的网络属于这一套
|
||||
if (location is GsmCellLocation) {
|
||||
val cellid = location.cid
|
||||
return cellid.toString()
|
||||
// Cdma网络 , 电信网络属于这一种
|
||||
} else if (location is CdmaCellLocation) {
|
||||
return location.baseStationId.toString()
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user