From bd6a8872438a35d47821c5d5da7fe149e5fed3ab Mon Sep 17 00:00:00 2001 From: lmw <125975490@qq.com> Date: 星期三, 21 六月 2023 09:53:36 +0800 Subject: [PATCH] 处理收不到广播 --- app/src/main/java/com/okgoincar/base/MainBroadCastReceiver.kt | 29 +++++------------------------ 1 files changed, 5 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/okgoincar/base/MainBroadCastReceiver.kt b/app/src/main/java/com/okgoincar/base/MainBroadCastReceiver.kt index 711e4cf..54057fb 100644 --- a/app/src/main/java/com/okgoincar/base/MainBroadCastReceiver.kt +++ b/app/src/main/java/com/okgoincar/base/MainBroadCastReceiver.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.os.Handler import android.os.Looper +import android.util.Log import cn.sinata.rxnetty.netStatus.NetUtils import cn.sinata.xldutils.utils.toast import com.google.gson.Gson @@ -23,6 +24,8 @@ class MainBroadCastReceiver : BroadcastReceiver() { override fun onReceive(contexts: Context?, intent: Intent?) { + MyApplication.upLog("收到广播,Action:${intent?.action}") + Log.e("MoneyBroadCastReceiver","收到广播,Action:${intent?.action}") if (intent == null) { toast("内容获取为空,广播接收消息错误") return @@ -43,6 +46,7 @@ if (driverCertificate == null) { // toast("身份证获取失败") } else { + MyApplication.upLog("广播参数:driverCertificate:${driverCertificate},开始登录") if (contexts == null) { // toast("上下文为空,使用全局跳转") toLoginActivity(MyApplication.getInstance(), driverCertificate) @@ -67,34 +71,11 @@ } } -// private fun toLoginActivity(context: Context?, driverCertificate: String?) { -// var map = getMapByAny() -// map["identification"] = driverCertificate -// callNet(context!!, Api.loginByIdentification, map) { -// toast("登录成功") -// var bean = Gson().fromJson<LoginBean>(it, LoginBean::class.java) -// CacheKey.putKeyStr("identification", driverCertificate!!) -// CacheKey.putKeyStr("appid", bean.data.appid) -// CacheKey.putKeyStr("token", bean.data.token) -// CacheKey.putKeyStr("userId", bean.data.id.toString()) -// CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) -// CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) -// Handler(Looper.getMainLooper()).post { -// var intent = Intent() -// intent.setClass(context, SlabMainActivity::class.java) -// intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK -// context.startActivity(intent) -// } -// } -// } - private fun toLoginActivity(context: Context?, driverCertificate: String?) { var map = getMapByAny() if (driverCertificate.isNullOrEmpty()){ -// toast("资格证号:空") + toast("资格证号:空") return - }else{ -// toast("资格证号:"+driverCertificate) } map["taxiAptitudeCard"] = driverCertificate callNet(context!!, Api.loginByTaxiAptitudeCard, map) { -- Gitblit v1.7.1