iOS Question WebView in iOS....

Discussion in 'iOS Questions' started by eps, Oct 31, 2018.

Similar threads

B4A Code Snippet [B4X] Use WebView to show large images
B4A Code Snippet [B4X] [XUI] Faster* DrawPolygon Method
B4i Code Snippet WebView "extra"
B4i Tutorial ATS - App Transport Security
B4i Tutorial iUI8 library
  1. eps

    eps Well-Known Member Licensed User

    I've developed a few small Apps in B4A, but I'm conscious that I need to place them on iOS as well...

    I'm working towards a game, with HTML5, Javascript and using Babylon.js

    Has anyone converted a WebView from B4A? If so can they let me know if they have been able to successfully convert the following code or point me in the right direction of getting the relevant libraries in place or a possible starting place please?

    I've seen this thread,

    https://www.b4x.com/android/forum/threads/webview-extra.48304/

    which seems to suggest that the libraries I'm interested in aren't yet available but I'm just wondering if anyone had worked through the problems already?

    My code is :

    Code:
    '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)

        wvs.setDisplayZoomControls(wv,
    False)



        
    Activity.AddView(wv,0,0,100%x,100%y)

        wv.LoadUrl(
    "file:///android_asset/index.html")

       ime1.Initialize(
    "ime1")

       ime1.AddHeightChangedEvent

       
    Dim jo As JavaObject = Activity

       jo.RunMethodJO(
    "getContext"Null).RunMethodJO("getWindow"Null).RunMethod("setSoftInputMode", _

        
    Array As Object(0x20))

        ActivityParent = jo.RunMethodJO(
    "getParent"Null)
    Which uses WebViewExtras and WebViewSettings... I'm up for converting the libraries if needed, but it would be my first time wrapping a library! I guess its something I need to do!!

    My whole reason for developing in HTML5 and Babylon.js was to enable the code to work on multiple platforms as easily as possible...! Now I'm not so sure....

    MTIA
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. This is not the correct way to develop with B4X. Watch the XUI video tutorials.

    2. Which features are you missing?

    3. Check XUI.FileUri for a better way to load assets resources.
     
  3. eps

    eps Well-Known Member Licensed User

    Ah yes - sorry! I should point out, for the over-riding majority of my projects they are developed in B4A. This project is a brand new one, a web based game in 3D, therefore I thought the best way forward for that, certainly in terms of portability was to develop using HTML5 and Javascript - as this is what Babylon.js is written in and it works really well (it's the 3D gaming version of B4A - it does what it says it does and it does it well!)
     
  4. eps

    eps Well-Known Member Licensed User

    Hi @Erel (or anyone else!)

    So just to make sure... So based on my extra information above about producing a 3D game and using Babylon.js am I right in thinking that a WebView is the best way forward with this or would you still recommend XUI? It seems to be mostly for 2D games, but maybe I just missed something or misunderstood something?

    Thanks!
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    XUI2D is indeed intended for 2d games.

    I'm not familiar with babylon.js. If it meets your requirements then using WebView sounds like a good option. Note that WKWebView (iUI8) is preferred over WebView.
     
    eps likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice