Android Question [SOLVED] Webview, HTML5, Babylon.js and Javascript sdk CORS issue...

eps

Expert
Licensed User
Longtime User
I've finally put together some code for a game, it all seems to work 'okay' but...

I had the manifest set to

<uses-sdk android:minSdkVersion="6" android:targetSdkVersion="14"/>

This works.

I then set the min and target SDK versions to 26 and it doesn't work... Well it does work but it can't load the files to display the graphics. User input works and it displays a primitive graphic element which is drawn using babylon.js (but that's just a tube) but this tells me that it all works, apart from the file access..

<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26"/>



I start to get COR Cross Object Reference errors. Is this something I can sort 'easily'? I've uploaded the html file and javascript file - but not all the libraries and I can't upload the apk as it's too big for the forum. Happy to send an APK if that would help.

Any thoughts? I've tried searching here and elsewhere but either I'm asking the wrong question or it's something "obvious". I mean obviously its something to do with the increased permissions but I'm not entirely sure how to resolve the permissions issue. The images were stored in subdirectories, below the Files folder but even moving them there doesn't seem to have resolved the issue.

I'm using the Babylon.js lib to handle input and display of graphics


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

Attachments

  • Screenshot_20181028-144424.png
    243.2 KB · Views: 492
  • index_html.zip
    644 bytes · Views: 394
  • app_js.zip
    3.3 KB · Views: 416

eps

Expert
Licensed User
Longtime User
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Only set your target SDK to 26. Don't set your minimum to 26, or you'll kill off about 80% of the devices out there. Alot of new tablets are running 7.X and less. Still...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…