Android Question HTML5 Wrapper Screen Problem

khwarizmi

Active Member
Licensed User
Longtime User
Hello all

Using this sample I converted an HTML5 project designed by a Storyline into apk .
A problem appeared in the screen as it appears to be defective on most devices as follows:

Screenshot_20210129-114305.png


this is my code:

B4X:
If File.Exists(File.DirInternal & "/lsn", "") = False Then
        ' The HTML5 file is first a zip file in DirAssets
        File.MakeDir(File.DirInternal,"lsn")
        Dim myZip As ABZipUnzip
        File.Delete(File.DirInternal,"1.zip")
        File.Copy(File.DirAssets , "1.zip",File.DirInternal,"1.zip")
        myZip.ABUnzip(File.DirInternal & "/1.zip" , File.DirInternal & "/lsn/")
        File.Copy(File.DirAssets , "1.zip",File.DirInternal,"1.zip")
        
    End If
    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("file:///" & File.DirInternal & "/lsn/story_html5.html")
    
    wv.ZoomEnabled=True
   ime1.Initialize("ime1")
   ime1.AddHeightChangedEvent
   Dim jo As JavaObject = Activity
   jo.RunMethodJO("getContext", Null).RunMethodJO("getWindow", Null).RunMethod("setSoftInputMode", _
     Array As Object(0x20))
 

amidgeha

Active Member
Licensed User
Longtime User
Go to manifest editor and change targetSdkVersion=29
You need to reference a newer version of android.jar (Tools - Configure Paths).

1.png

2.png
 

Attachments

  • 1.png
    1.png
    144.3 KB · Views: 160
  • 2.png
    2.png
    139.7 KB · Views: 153
Last edited:
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
thanks @amidgeha , the screen problem has been resolved, but a problem appears when I press some buttons and when playing some videos, even though I updated the android.jar and the sdk.

when I press lesson name button in the first page:
B4X:
Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. in file:///data/user/0/com.ar.two/files/lsn/mobile/player_compiled.js (Line: 1897)

when I press the video button:
B4X:
Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. in file:///data/user/0/com.ar.two/files/lsn/mobile/player_compiled.js (Line: 1897)
 
Upvote 0

amidgeha

Active Member
Licensed User
Longtime User
thanks @amidgeha , the screen problem has been resolved, but a problem appears when I press some buttons and when playing some videos, even though I updated the android.jar and the sdk.

when I press lesson name button in the first page:
B4X:
Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. in file:///data/user/0/com.ar.two/files/lsn/mobile/player_compiled.js (Line: 1897)

when I press the video button:
B4X:
Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. in file:///data/user/0/com.ar.two/files/lsn/mobile/player_compiled.js (Line: 1897)

Add this to your manifest:
SetApplicationAttribute(android:usesCleartextTraffic, "true")
 
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
Unfortunately the problem still persists šŸ™
 
Upvote 0
Top