iOS Question webview for ios

paul fredrick

Member
Licensed User
Longtime User
I used this code with android and it works well, I ask if and how to use it with ios. thanks

B4X:
#Region  Project Attributes
    #ApplicationLabel: test
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: TRUE
    #IncludeTitle: FALSE
#End Region

Sub Process_Globals
    Private rp As RuntimePermissions
End Sub

Sub Globals
    Private WebView1 As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    rp.CheckAndRequest(rp.PERMISSION_CAMERA)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Result Then
            Dim client As JavaObject
            client.InitializeNewInstance(Application.PackageName & ".main$MyChromeClient", Null)
            Dim jo As JavaObject = WebView1
            jo.RunMethod("setWebChromeClient", Array(client))
            
            WebView1.LoadUrl("https://somesite.com")
        End If
    End If
End Sub


#if Java
import android.webkit.*;
public static class MyChromeClient extends WebChromeClient {
@Override
     public void onPermissionRequest(PermissionRequest request) {
        request.grant(request.getResources());
    }
}
#End If
 

Semen Matusovskiy

Well-Known Member
Licensed User
In current B4i release WebView is a wrapper over IOS WKWebView and has methods and events very similar to B4a. Simply take a look a documentation. For example, PageFinished has two input parameters
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
According to this article "example for location permission", I think using B4i webview makes IOS requests permission "camera, location or etc." from user, Have you test it on real device iPhone?
 
Upvote 0
Top