Android Code Snippet Simple HTML5 app wrapper

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

  • shot.jpg
    shot.jpg
    41.8 KB · Views: 1,459
  • html5app.zip
    499.3 KB · Views: 2,377

Beja

Expert
Licensed User
Longtime 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
Longtime User
Thank you Erel,
It's working fine now.. I was using android.jar 8 and now updated to 17.
 

stevel05

Expert
Licensed User
Longtime User
It downloads Ok here.
 

holdemadvantage

Active Member
Licensed User
Longtime 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
Longtime 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
Longtime 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 :)
 
Top