I have a AR website that works great on my desktop. It also works on my mobile if I use the chrome browser. How can I get the webview to accept the permission? In a B4X webview. What am i doing wrong here. I get The page at "https://tekh3999.gethub.io" says"
Webcam Error
Name: NotAllowedError
Message: Permission denied
Webcam Error
Name: NotAllowedError
Message: Permission denied
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'cam stuff
Private frontCamera As Boolean = False
Dim phid As PhoneId
Dim rp As RuntimePermissions
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim wv As WebView
Dim wve As WebViewExtras
Dim wvs As WebViewSettings
Private ime1 As IME
Private ActivityParent As JavaObject
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
wv.Initialize("wv")
wve.addWebChromeClient(wv,"wve")
wvs.setAllowFileAccess(wv,True)
wvs.setAppCacheEnabled(wv,True)
wvs.setDOMStorageEnabled(wv,True)
Activity.AddView(wv,0,0,100%x,100%y)
wv.LoadUrl("https://tekh3999.github.io/tekh3999ar7.github.io/")
Log("tried to connect")
ime1.Initialize("ime1")
ime1.AddHeightChangedEvent
Dim jo As JavaObject = wv
Dim settings As JavaObject = jo.RunMethod("getSettings", Null)
jo.InitializeContext
'jo.RunMethod("SetChrome", Array(wve))
Dim r As Reflector
r.Target = settings
r.RunMethod2("setAllowUniversalAccessFromFileURLs", True, "java.lang.boolean")
End Sub
Sub Activity_Resume
For Each permission As String In Array (Starter.rp.Permission_CAMERA)
Starter.rp.CheckAndRequest(Starter.rp.Permission_CAMERA)
wait for Activity_PermissionResult (permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission!", True)
Log("no Permission")
Activity.Finish
Return
Else
If Result = True Then
End If
End If
Next
End Sub
Sub Activity_PermissionResult (Permision As String, Result As Boolean)
If Permision = Starter.rp.PERMISSION_CAMERA Then
Activity_PermissionResult (Permision, True)
Result = True
End If
End Sub
Sub client_ReceivedSslError(SslErrorHandler1 As SslErrorHandler, SslError1 As SslError)
Log(SslError1)
SslErrorHandler1.Proceed
End Sub
Sub IME1_HeightChanged (NewHeight As Int, OldHeight As Int)
End Sub
Sub AfterChange
Dim ajo As Panel = Activity
Dim width As Int = ActivityParent.RunMethod("getMeasuredWidth", Null)
Dim height As Int = ActivityParent.RunMethod("getMeasuredHeight", Null)
If width = 0 Or height = 0 Then Return
ajo.width = width 'update the "activity" width and height
ajo.height = height
wv.width = width
wv.height = height
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
' the official google vr library documentation recommends to call the Shutdown() method before the activity is destroyed
' we'll use inline java to ensure that the Shutdown() method is called
#if java
#End If