Android Code Snippet Simple HTML5 app wrapper

Jack Cole

Active Member
Licensed User
I put together a little app to wrap an HTML5 app in B4A. Of course you could do this with phonegap, or something else, but you get a lot more power and control using B4A. Using jsinterface from webviewextras, you can interact between B4A code and your HTML5/js app. This opens up the full range of B4A features that you could access to make a hybrid app.

I put this together from other snippets I have found in the forums, so about the only thing I can take credit for is putting it all together in one place. I thought I'd share with others in case anyone else wants to be able to do this.

Some helpful things implemented within this app are the ability to change orientation without reloading the webview and the ability to use local storage.

Best regards,
Jack
 

Attachments

JakeBullet70

Well-Known Member
Licensed User
Interesting, I will have to put this on my to check out list!
 

Beja

Expert
Licensed User
Thanks Jack for sharing this.. I got the following error in compile time:

Parsing code. 0.03
Compiling code. 0.14
Compiling layouts code. 0.01
Generating R file. Error
AndroidManifest.xml:18: error: Error: String types not allowed (at 'configChanges' with value 'orientation|keyboardHidden|screenSize').

Any meaning appreciated
 

Beja

Expert
Licensed User
Thank you Erel,
It's working fine now.. I was using android.jar 8 and now updated to 17.
 

stevel05

Expert
Licensed User
It downloads Ok here.
 

holdemadvantage

Active Member
Licensed User
Hi, i've finally teuied this and it's cool. I have a problem with a game, the game in webviewextras doesn't play sound while in normal browser the game is working ok
Are there some settings to enable sound in wwextra?
Thanks in advance!

Edit. i check with html5test dot com that maybe webviewextra is not compatible with web audio api , maybe this can be the issue?
 
Last edited:

Phayao

Active Member
Licensed User
Hello, great idea, but unfortunately when I open the demo it just shows "Webpage not available"
Do you have to copy the index.html from assets to the internal storage ?
Sorry for the stupid question, I am not aware where the link "file:///android_asset/index.html" points to ?
Thanks for clarifying,
Chris
 

eps

Expert
Licensed User
Hi, I know this is old, but I'm only getting round to finally making some inroads on a game I've been mulling over using html5 and babylonjs... I was going to go full 3D initially but might scale it back to be 2D only initially and then adjust to 3D...

Many thanks @Jack Cole for posting this wrapper as it works really well :)
 

Syd Wright

Well-Known Member
Licensed User
Thank you. I get a black screen, but after touching the screen I do get to see the pause / play button.
Probably thread #7 is the reason.
Do you/anyone know if HTML5 video's still somewhere use a (hidden) ...m3u8 or rtmp... stream?

Update: You are right: it is device-specific. The video doesn't open on my Nexus-7 (2012) with Android 4.3, but it is fine on my Samsung J5 with Android 6.

I am very pleased with your code.
 
Last edited:
Top