androidwebview

Render webview Android 6


I'm developing a mobile app which shows a webview to users. In android 7.1.1 and higher versions all urls render perfectly fine, but in android 6 I've got some problems with some urls. For example, if I render https://www.amazon.com, it works fine in my android 6 emulator:

Amazon site

But if I try with some other urls, for example https://slack.com/intl/es-ar/, I've got a blank screen:

Slack site

My kotlin code is the following:

package com.example.webview

import android.os.Bundle
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity : AppCompatActivity() {
   private lateinit var webView: WebView

   override fun onCreate(savedInstanceState: Bundle?) {
     super.onCreate(savedInstanceState)
     enableEdgeToEdge()
     setContentView(R.layout.activity_main)
     ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
          val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
          v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
          insets
     }

      webView = findViewById(R.id.webView)

      webView.webViewClient = WebViewClient()

      webView.loadUrl("https://slack.com/intl/es-ar/")

      webView.settings.javaScriptEnabled = true

      webView.settings.domStorageEnabled = true

      webView.settings.setSupportZoom(true)
  }
}

I'm not sure what could be the problem.


Solution

  • Slack is using Let's Encrypt for SSL certificates (at least for that site), and Let's Encrypt only supports Android 7.0 and higher.