Can I get Camera access in App Inventor Webviewer using CustomWebView Extension if Yes then How? Thank You
I try this code but doesn't work
I think you have to use this block too
Yes you can.
That method only works when webview requests for permissions and triggers OnPermissionRequest event.
Also your app should also have same permission which you want to grant to webview.
It still doesn't work please help
Try adding the AppInventor Camera component to get permission.
Also, if your test fails under the Companion, try again with an APK.
My website needs camera access from the browser if I use this site on chrome this works but on CustomWebView I'm not getting a pop-up to allow the camera. That's my code and website
https://tcbvideochat.000webhostapp.com
S
This is an universal solution:
Also mostly websites need these permissions:
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
@DesignerComponent(version = 9, description ="An extended form of Web Viewer <br> Developed by Sunny Gupta", category = ComponentCategory.EXTENSION, nonVisible = true, iconName = "https://res.cloudinary.com/andromedaviewflyvipul/image/upload/c_scale,h_20,w_20/v1571472765/ktvu4bapylsvnykoyhdm.png",helpUrl="https://github.com/vknow360/CustomWebView",androidMinSdk = 21)
@UsesActivities(activities = {@ActivityElement(intentFilters = {@IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.VIEW")}, categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT"), @CategoryElement(name = "android.intent.category.BROWSABLE")}, dataElements = {@DataElement(scheme = "http"), @DataElement(scheme = "https")}), @IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.VIEW")}, categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT"), @CategoryElement(name = "android.intent.category.BROWSABLE")}, dataElements = {@DataElement(scheme = "http"), @DataElement(scheme = "https"), @DataElement(mimeType = "text/html"), @DataElement(mimeType = "text/plain"), @DataElement(mimeType = "application/xhtml+xml")})},name="com.sunny.CustomWebView.CustomWebView$WebActivity")})
@SimpleObject(external=true)
@UsesPermissions(permissionNames="android.permission.WRITE_EXTERNAL_STORAGE,android.permission.ACCESS_DOWNLOAD_MANAGER,android.permission.ACCESS_FINE_LOCATION,android.permission.RECORD_AUDIO, android.permission.MODIFY_AUDIO_SETTINGS, android.permission.CAMERA,android.permission.VIBRATE,android.webkit.resource.VIDEO_CAPTURE,android.webkit.resource.AUDIO_CAPTURE,android.launcher.permission.INSTALL_SHORTCUT")
public final class CustomWebView extends AndroidNonvisibleComponent {
public Activity activity;
public WebView webView;
public Context context;
public boolean followLinks = true;
public boolean prompt = true;
public String UserAgent = "";
public boolean ignoreSslErrors = false;
WebViewInterface wvInterface;
public JsPromptResult jsPromptResult ;
But why your blocks look different.
Error while using this app-:
Because you did not allow that permission.
Tap on allow when permissions are asked.
pop-up not showing that's why I use camera component and call it on button click so this will ask for permission. then I allow camera permission, but still doesn't work,
I'm doing something wrong?... please review my code.
Thank You
That's my code
Which version are you using?
Make sure you use latest version.
Also post an apk and aia.
Version updated still doesn't work Here is my aia file. webviewextended (1).aia (78.3 KB)
Have you tested with latest version v10 ? If not download it from GitHub
1 Like
michal_popoola:
Me too don't know why
Try asking for permission manually when needed.
You can also use your own logic.
Copy-pasting is not a reliable solution.
I also tested. In the application settings, the permissions are granted to:
camera
location
microphone
storage
After starting the application, the error message 908 shown above still appears. Of course, version 10 of the extension.
Show your blocks.
Also note that when you grant permission to webview then it is only granted to current webview so if you create another webview and visit same page, it will need those permissions again.
What I want is for the code to visit Kingex.xyz/app
And grant it camera ,storage and Microphone permission