唐浩
1 天以前 c92e2c6ba9176a971802e2217e0661dec03286b7
app/src/main/java/com/zhaoyang/driver/base/MyApplication.kt
@@ -78,7 +78,7 @@
        registerActivityLifecycleCallbacks(this)
        PlatformConfig.setWeixin("wx6078319d54d38c66", "c3ef243fae93fb0fd093d457ada38b4c")
        PlatformConfig.setQQZone("102047428", "qcBXgbJo6B2f5HF0") //qq互联
//        CrashReport.initCrashReport(getApplicationContext(), "444bb776ed", false);
        CrashReport.initCrashReport(this, "6f590c5687", true)
        LogUtils.OpenLog(true)
//        initUpPoint()
        initSocket()
@@ -87,7 +87,7 @@
        setAlisa()
    }
    public fun setAlisa() {
    fun setAlisa() {
        if (CacheKey.getUserId().isNotEmpty()) {
            var alisa = "DRIVER" + CacheKey.getUserId()
            sysErr(alisa)
@@ -370,22 +370,34 @@
        }
    }
    private var errorCount = 0 //定位上传失败次数
    private fun sendLocation() {
        if (getUserId() != -1 && aMapLocation != null) {
            val bean = CarLocationBean()
            val dataBean = CarLocationBean.DataBean(
                getUserId(),
                currentOrderId,
                currentOrderType,
                aMapLocation!!.longitude,
                aMapLocation!!.latitude,
                aMapLocation!!.bearing.toDouble(),
                aMapLocation!!.altitude
            )
            bean.data = dataBean
            NettyClient.getInstance()
                .sendMessage(Gson().toJson(bean))
            sysErr(dataBean.toString())
        if (getUserId() != -1) {
            if (aMapLocation == null|| aMapLocation!!.latitude <= 0){
                errorCount++
                if (errorCount == 10){
                    Handler(Looper.getMainLooper()).postDelayed({
                        getTTsManager().setVideoText("司机定位异常,请检查手机网络定位并重启司机APP")
                        errorCount = 0
                    }, 600)
                }
            }else{
                errorCount = 0
                val bean = CarLocationBean()
                val dataBean = CarLocationBean.DataBean(
                    getUserId(),
                    currentOrderId,
                    currentOrderType,
                    aMapLocation!!.longitude,
                    aMapLocation!!.latitude,
                    aMapLocation!!.bearing.toDouble(),
                    aMapLocation!!.altitude
                )
                bean.data = dataBean
                NettyClient.getInstance()
                    .sendMessage(Gson().toJson(bean))
                sysErr(dataBean.toString())
            }
        }
    }