[base_3.4.0-map-sdk]

This commit is contained in:
zhongchao
2023-08-18 18:42:12 +08:00
parent 10b5933c03
commit fc25630dc4
43 changed files with 644 additions and 790 deletions

View File

@@ -22,7 +22,7 @@ import com.zhjt.service.chain.ChainLog
* 封装高德地图通过设备GPS获取到的位置信息频率1s一次坐标系为CJC20
* 这里的数据仅用于非高精度业务
*/
class GDLocationClient private constructor(context: Context) : AMapLocationListener,
class GDLocationClient private constructor() : AMapLocationListener,
IMogoGDLocationClient {
//声明LocationClient对象
private lateinit var mLocationClient: AMapLocationClient
@@ -40,7 +40,7 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
Handler(thread.looper)
}
init {
override fun start(context: Context) {
AMapLocationClient.updatePrivacyShow(context, true, true)
AMapLocationClient.updatePrivacyAgree(context, true)
try {
@@ -60,9 +60,6 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun start() {
if (mLocationClient != null) {
mLocationClient.startLocation()
}
@@ -169,20 +166,8 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
}
companion object {
@Volatile
private var gdLocationClient: GDLocationClient? = null
private val obj = ByteArray(0)
@JvmStatic
fun getInstance(context: Context): GDLocationClient? {
if (gdLocationClient == null) {
synchronized(obj) {
if (gdLocationClient == null) {
gdLocationClient = GDLocationClient(context)
}
}
}
return gdLocationClient
val gdLocationClient by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
GDLocationClient()
}
}
}