B4J Tutorial [ABMaterial] Opening your app inside B4A WebView


Licensed User

My intention was to have an Android Play Store for my ABM app. I needed my app to remember the login details, meaning that it needs to access localstorage.

Thing is, local storage is not accessible with the normal webview. That's where WebViewExtras come in.

I'm using WebViewExtras2.

Let's go.

In Globals, I reference my classes.

Private wbe As WebViewExtras
    Private wcc As DefaultWebChromeClient
In Activity_Create, I start up a few things...

My webview sits on a layout, so I load the layout first and then...

    WebView1.JavaScriptEnabled = True
    WebView1.ZoomEnabled = False
On interesting thing I checked out was the wcc_console when I was running my app.

Sub wcc_ConsoleMessage(ConsoleMessage1 As ConsoleMessage) As Boolean
End Sub
Off course you can remove the console code... but it helps also to see your app execution from the B4A side.

So I compiled by 1 page app and off to the play store. Installed in on my phone and nicely, I have a nice ABM app running on my Android as if its native, without the necessity of opening a browser.


Licensed User
Wasn't it possible to just build this in the ABM Native Example?

Note that there is a trend (Apples App store does it already) to ban such apps (just a webview going to a website). So it is quite possible Android will follow quickly. If it is an inhouse app, then you are probably OK.


Licensed User
Thanks AB for the heads up. I will at some stage educate myself on the ABM Native Platform where a mobile app is of a more emphasis. For now it was just a play and see approach as I'm just starting my focus on small devices. Im sure as more I am comfortable I will evolve to ABM Native. Ta!

PS: Besides the WebView, on the app I have I resoluted to use the newest image processing that Erel posted for a splash screen. It creates this nice effect of the image pieces coming together whilst the WebView is loading in the background.
Last edited: