I have a link to 360 Image for the mobile site but I want to load that in WebView in my App. Link works perfectly on the native mobile browser as well as Google Chrome, but not in the WebView in my App.
Any help is Appreciated. Thanks.
I have a link to 360 Image for the mobile site but I want to load that in WebView in my App. Link works perfectly on the native mobile browser as well as Google Chrome, but not in the WebView in my App.
Any help is Appreciated. Thanks.
We can load the 360 degree url(also vr) using the below webview settings.
binding.webView.settings.javaScriptEnabled = true
binding.webView.settings.allowFileAccess = true
binding.webView.settings.pluginState = WebSettings.PluginState.ON
binding.webView.settings.domStorageEnabled = true
binding.webView.settings.allowContentAccess = true
binding.webView.settings.loadsImagesAutomatically = true
binding.webView.settings.blockNetworkImage = false
binding.webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, url: String?): Boolean {
if (url != null) {
view.loadUrl(url)
}
return true
}
override fun onPageFinished(view: WebView?, url: String?) {
}
}
binding.webView.settings.javaScriptCanOpenWindowsAutomatically = true
binding.webView.webChromeClient = WebChromeClient()
binding.webView.loadUrl("url")
Lately, but I think this will helpful to someone. In your activity using webview, set this in androidmanifests set:
android:hardwareAccelerated="true"
And my webview like this:Try this, It will work perfectly!