diff --git a/app/src/main/java/org/traccar/manager/MainFragment.kt b/app/src/main/java/org/traccar/manager/MainFragment.kt index fe435b8..eee7703 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.kt +++ b/app/src/main/java/org/traccar/manager/MainFragment.kt @@ -64,7 +64,7 @@ class MainFragment : WebViewFragment() { if ((activity.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0) { WebView.setWebContentsDebuggingEnabled(true) } - webView.webViewClient = WebViewClient() // handle redirects in the app + webView.webViewClient = webViewClient webView.webChromeClient = webChromeClient webView.addJavascriptInterface(AppInterface(), "appInterface") val webSettings = webView.settings @@ -134,6 +134,16 @@ class MainFragment : WebViewFragment() { private var geolocationRequestOrigin: String? = null private var geolocationCallback: GeolocationPermissions.Callback? = null + private val webViewClient = object : WebViewClient() { + + override fun onPageFinished(view: WebView?, url: String?) { + super.onPageFinished(view, url) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + CookieManager.getInstance().flush() + } + } + } + private val webChromeClient = object : WebChromeClient() { override fun onCreateWindow(view: WebView, isDialog: Boolean, isUserGesture: Boolean, resultMsg: Message): Boolean {