Change from CordovaWebView to SystemWebView in latest Cordova not working
See original GitHub issueI stuck in my old version Android App based on Codova
I updated My Android App to latest version android@7.0.0
Now where i used CordovaWebView for for Webview in my app as follows
<org.apache.cordova.CordovaWebView
android:id="@+id/cordovaWebCallWebView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
but it’s not present in latest version of Cordova. So I changed to it by below lines
<org.apache.cordova.engine.SystemWebView
android:id="@+id/SystemWebView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
where i am using WebRtc for my App So I used following method of SystemWebView Class
cwv.setWebChromeClient(new WebChromeClient() {
@Override
public void onPermissionRequest(final PermissionRequest request) {
javaToJavascript.webrtcCallLog("web.java", "permission asked is"+Arrays.deepToString(request.getResources()),0); //This logs the type of permission asked
Log.i("The list of permission asked is ", Arrays.deepToString(request.getResources())); // this askes for android.webkit.resource.AUDIO_CAPTURE permission
getActivity().runOnUiThread(new Runnable() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void run() {
Log.i("Value Of the permission asked is ", request
.getOrigin().toString());
request.grant(request.getResources());
}
});
}
});
Now i got runtime error in my Main java file regarding classCastException
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.simCard.web/com.simCard.web.WebCall}: java.lang.ClassCastException: com.simCard.web.WebCall$1 cannot be cast to org.apache.cordova.engine.SystemWebChromeClient
How to solve This error ? Please any ones help will be grateful
Thank you
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Cordova not using the latest Android System Webview
After doing some research, it appears the problem stems from the Android device being 'hardcoded' to access the webview from com.android.webview ...
Read more >Android WebViews - Apache Cordova
To follow these instructions, make sure you have the latest Cordova distribution. · Navigate to the Android package's /framework directory and run ant...
Read more >Cordova changed its webview from org ... - Google Groups
This causes me great problems because I can not query the webview anymore. I tried to query the SystemWebView like this query("SystemWebView css:'*'")...
Read more >Cordova Webview Schemes/Protocols - Mat's Blog
This can sometimes cause issues, perhaps you're loading in a third party script that checks window.location and uses the current protocol to ...
Read more >Cordova-plugin-webviewselector - npm.io
Crosswalk being not maintained anymore, the future is in the use of system's webview. But on older devices you may want to keep...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My response is in https://github.com/apache/cordova-docs/issues/884#issuecomment-438318495. In short a pull request would be really appreciated.
I would prefer that we keep further discussion in https://github.com/apache/cordova-docs/issues/884 instead of this closed issue.
I had a hard time with the documentation and tried to reflect my findings in this update: https://github.com/apache/cordova-docs/commit/6dc8836ff669dbd6825093740a3115cb0c08b1c2
Can somebody check if this is useful for others?