WebView and https lazarus / 43-Android ---------------------------------------------------------------------- alpine · 2021-08-25 16:53 Does anybody knows how to handle SSL Certificate errors in jWebView? It opens http locations, but when it reaches the https URL with untrusted certificate it does just nothing. Perhaps it misses a handler for the SSL errors: Code: Java  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @Overridepublic void onReceivedSslError(WebView view,...) Thanks in advance! ---------------------------------------------------------------------- Mongkey · 2021-08-27 07:47 Try look at manifest, set clear traffic, may be it helps ---------------------------------------------------------------------- alpine · 2021-08-27 14:50 Quote from: Mongkey on August 27, 2021, 09:47:53 amTry look at manifest, set clear traffic, may be it helps For the manifest: I didn't realize yet how to include permissions other than those listed into Project Options/LAMW Configuration. For example, I need to use the microphone. The manifest gets overwritten every time, I just can't simply put it there. Same with the jWebView.java - it comes fresh on every build from LAMW directories. I've modified it there, added the onReceivedSslError() in jWebViewClient, and it works now for the untrusted certificate. But my next trouble is with the permissions. I'm opening a video chat site into the jWebView and it can't get the mic, because of no permissions. Looking at large, these android bridges aren't bridging most of the methods, and maybe, the only way is to modify the LAMW itself. ---------------------------------------------------------------------- jmpessoa · 2021-08-27 16:02 QuoteI need to use the microphone. The manifest gets overwritten every time, I just can't simply put it there. Please, put here what permission you need ... QuoteI've modified it there, added the onReceivedSslError() in jWebViewClient, Please, put code here ... I will try updated jWebViewClient! Thank you! ---------------------------------------------------------------------- alpine · 2021-08-27 17:06 Quote from: jmpessoa on August 27, 2021, 06:02:49 pmQuoteI've modified it there, added the onReceivedSslError() in jWebViewClient, Please, put code here ... I will try updated jWebViewClient! The code I've tried was: Code: Java  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @Overridepublic void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {    handler.proceed(); // Ignore SSL certificate errors}I took it from: https://stackoverflow.com/questions/7416096/android-webview-not- loading-an-https-url But it was just a workaround to see if it was the real issue. I suggest the real method should call/bridge to an event handler in Lazarus code to allow user choice whether to proceed or not. And that is a little bit complicated for me, I'm not a true Java developer. That's why I'm using laz4android. Since the workaround worked, then I hit the problem with the permissions. And as long the camera permission can be given, the mic is not included into the LAMW table. Quote from: jmpessoa on August 27, 2021, 06:02:49 pmQuoteI need to use the microphone. The manifest gets overwritten every time, I just can't simply put it there. Please, put here what permission you need ... I believe they're: Code: [Select]android.permission.MODIFY_AUDIO_SETTINGS android.permission.RECORD_AUDIOAgain, considering: https://stackoverflow.com/questions/62037838/android-webview-not- getting-camera-and-mic-enabled-for-conference But I can't be really sure until trying.  Furthermore, in the above thread, it was noted that: QuoteAfter getting those permissions, you need to override onPermissionRequest in WebChromeClient like this: Code: Java  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i webView.setWebChromeClient(new WebChromeClient() {  @Override   public void onPermissionRequest(final PermissionRequest request) {       request.grant(request.getResources());}});And that is just another modification in the jWebView.java. Thank you for your reply and all your efforts regarding LAMW! ---------------------------------------------------------------------- Mongkey · 2021-08-27 19:26 Oh, Sorry Sometimes website has invalid ssl/bad ssl, let say you want visit that site over jWebView? Example site with bad ssl https://expired.badssl.com/ I think this thread also lead overriding permission on jWebview.java ---------------------------------------------------------------------- jmpessoa · 2021-08-28 06:50 Done! Improved jWebView component! New property:    DomStorage New event:   OnReceivedSslError New demo: "AppWebViewDemo1"     // <--- "how to" handle permissions! New methods: SetDomStorage SetLoadWithOverviewMode SetUseWideViewPort SetAllowContentAccess SetAllowFileAccess SetAppCacheEnabled SetDisplayZoomControls SetGeolocationEnabled SetJavaScriptCanOpenWindowsAutomatically SetLoadsImagesAutomatically SetSupportMultipleWindows SetAllowUniversalAccessFromFileURLs SetMediaPlaybackRequiresUserGesture SetSafeBrowsingEnabled SetSupportZoom SetUserAgent Thanks to All! ---------------------------------------------------------------------- alpine · 2021-08-28 12:40 It is quite strange, when I try to reach LAMW/Path Settings, laz4android gives me: Quote[Window Title] Lazarus IDE v2.0.0 - project1 [Content] Unable to open file "D:\devel\android\android-ndk-r10e\REALEASE.TXT". Press OK to ignore and risk data corruption. Press Abort to kill the program. [OK] [Abort]laz4android: Lazarus 2.0.0 rUnknown FPC 3.0.4 i386-win32-win32/win64 The file is actually there  Edit: That happened after I cloned fresh LAMW from github and rebuilt laz4android ---------------------------------------------------------------------- dseligo · 2021-08-28 13:06 Quote from: y.ivanov on August 28, 2021, 02:40:45 pmIt is quite strange, when I try to reach LAMW/Path Settings, laz4android gives me: Quote[Window Title] Lazarus IDE v2.0.0 - project1 [Content] Unable to open file "D:\devel\android\android-ndk-r10e\REALEASE.TXT". Press OK to ignore and risk data corruption. Press Abort to kill the program. [OK] [Abort]laz4android: Lazarus 2.0.0 rUnknown FPC 3.0.4 i386-win32-win32/win64 The file is actually there  Edit: That happened after I cloned fresh LAMW from github and rebuilt laz4android I just copied RELEASE.TXT and renamed it to REALEASE.TXT. It's spelling error somewhere. ---------------------------------------------------------------------- alpine · 2021-08-28 13:25 Quote from: dseligo on August 28, 2021, 03:06:13 pm*snip* I just copied RELEASE.TXT and renamed it to REALEASE.TXT. It's spelling error somewhere. REALEASE.TXT (?!) I should go for my glasses replacement. Thanks! ---------------------------------------------------------------------- jmpessoa · 2021-08-28 17:16 QuoteI just copied RELEASE.TXT and renamed it to REALEASE.TXT. It's spelling error somewhere.  It's spelling error .... LAMW?? I will try fix some fix.... ---------------------------------------------------------------------- dseligo · 2021-08-28 17:25 Quote from: jmpessoa on August 28, 2021, 07:16:40 pmQuoteI just copied RELEASE.TXT and renamed it to REALEASE.TXT. It's spelling error somewhere.  It's spelling error .... LAMW?? I will try fix some fix.... Yes, it's in following files: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i \ccr\lamw\a ndroid_wizard\uformworkspace.pas\ccr\lamw\android_wizard\smartdesigner .pas\ccr\lamw\ide_tools\uformsettingspaths.pas ---------------------------------------------------------------------- jmpessoa · 2021-08-28 17:46 Fixed!!! Thanks!