Access Camera Functionality In Android Webview?
I'm building a Native-Android/WebView-App thats code is hosted on a remote server (in HTML and Javascript). The Web App has a function that launches the phone's camera via a HTML
Solution 1:
While accessing Camera from Webview, it asks for permissions and we can grant them by overriding the onPermissionRequest. Also make sure to take care of runtime permissions.
webView.setWebChromeClient(newWebChromeClient() {
@OverridepublicvoidonPermissionRequest(PermissionRequest request) {
request.grant(request.getResources());
}
});
Also, make sure this property is disabled
webSettings.setMediaPlaybackRequiresUserGesture(false);
Post a Comment for "Access Camera Functionality In Android Webview?"