Android Question WEBVIEW and CAMERA

Jozef Kolovratkovic

New Member
Licensed User
Longtime User
I have a huge trouble making camera work in WEBVIEW.

I already done my browser app for face recognition. It works great in all browsers. I tested it on google chrome on my phone, tablet etc and it works great. Each time i get asked to allow camera, i allowed it and then it works correctly. So i only need to make app loading URL into webview with camera allowed. - But there is a problem - APP DO NOT ASK TO ALLOW CAMERA AT ALL. So camera is not showing in WEBVIEW ( but wokrs in google chrome browser on same device )

So i just want replace browser with my fullscreen app with webview using 100% width + 100% of height of screen.

How can i do that? For me there is only problem that app do not ask for allow camera. Application already have persmission for camera granted from app settings.

How can i make WEBVIEW access camera ?

CODE:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private okno As WebView
    Private Root As B4XView
    Private xui As XUI
    Dim WVE As WebViewExtras
    Dim WVS As WebSettings
    Dim telefon As Phone
    Dim ostan_online As PhoneWakeState
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("hlavne_okno")
    telefon.SetScreenOrientation(0)
    okno.width = Activity.width
    okno.height = Activity.height
    ostan_online.KeepAlive(True)
    WVE.Initialize(okno)
    WVE.LoadUrl("URL OF WHERE APP IS ALREADY RUNNING AND WORKING GOOD IN BROWSERS")
End Sub

manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"
    android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES"
    android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.WAKE_LOCK"
    android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.CAMERA"
    android:maxSdkVersion="30" />
)

SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
 

Ivica Golubovic

Active Member
Licensed User
You will find soluton here:
 
Upvote 0

Similar Threads

Top