Skip to content

Instantly share code, notes, and snippets.

private fun getClient(): WebViewClient {
return object : WebViewClient() {
override fun shouldInterceptRequest(
view: WebView?,
request: WebResourceRequest?
): WebResourceResponse? {
return super.shouldInterceptRequest(view, request)
}
override fun shouldInterceptRequest(view: WebView?, url: String?): WebResourceResponse? {
@jeffreydelooff
jeffreydelooff / NetworkHelper.kt
Last active July 15, 2021 12:18
Android NetworkHelper to connect to WiFi
class NetworkHelper @Inject constructor(
private val wifiManager: WifiManager
) {
fun connectToWifi(ssid: String, key: String) {
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
// Remove possible conflicting network suggestions as we're not allowed to edit them
wifiManager.removeNetworkSuggestions(
listOf(
WifiNetworkSuggestion.Builder()