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

Found bugs on android device internet status not update (Kotlin MultiPlatform) #29

Open
hafiz013 opened this issue Jul 18, 2024 · 0 comments

Comments

@hafiz013
Copy link

Scenario 1:

  1. When i do testing off wifi laptop, emulator android connected to wifi/3g this library still detect got internet connection (BUGS)

Scenario 2:
2) When i do testing off wifi laptop, emulator ios even show wifi icon above this library detect no internet (AWESOME)

Code :

  1. commonMain
expect fun createConnectivity(): Connectivity
  1. androidMain
actual fun createConnectivity(): Connectivity {
    return Connectivity {
        autoStart = false
    }
}
  1. iosMain
actual fun createConnectivity(): Connectivity {
    return Connectivity {
        autoStart = false
    }
}
  1. impelementation function :
override suspend fun <T> testing(apiCall: suspend CoroutineScope.() -> T): ApiResult<T>
    {
        val stateConnectivity = createConnectivity()
        stateConnectivity.start()
        return if(stateConnectivity.status().isConnected){
            stateConnectivity.stop()
            // do something
        }else
        {
            stateConnectivity.stop()
           // do something
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant