Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkUtils的isAvailable方法,在热点的数据网络关闭的情况下,会返回错误 #1795

Open
licoba opened this issue Jan 11, 2024 · 0 comments
Assignees
Labels

Comments

@licoba
Copy link

licoba commented Jan 11, 2024

描述 Bug

调试手机连接一个另外一个手机的移动数据热点,然后关闭热点手机的移动网络,也就是热点连上了,但是实际上是用不了的,就会返回错误。本来isAvailable应该返回false,但是却返回了true

  • AndroidUtilCode 的版本: utilcode:1.31.1
  • 出现 Bug 的设备型号:小米14、Pixel 7,随便什么安卓手机
  • 设备的 Android 版本:Android 14

相关代码


private suspend fun checkNetWork() {
     val ret = NetworkUtils.isAvailable()
    Log.e("TAG", "是否可用?"+ret)
}

private fun startJob() {
    lifecycleScope.launch(Dispatchers.Default + jobRefresh) {
        while (true) {
            delay(1000)
            checkNetWork()
        }
    }
}

截图

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants