In this post, I am gonna explain you how you can make a simple webviewer app for android devices in Kodular.
WebViewer is a component which is capable of displaying an web page within an application. You can use webviewer to create hybrid type mobile apps & can also convert your website into an application.
So once you have created your project in Kodular Creator, follow these steps:
Go to Layout>Views, then drag & drop a webviewer component into the screen.
Next you can configure your webviewer in the components panel, like if you want to disable JavaScript, or maybe disable Zoom, or maybe set a home page for your webviewer.
Alright, we are now done with the designer tab. Next we will go to blocks and program our app, so that it may load the website we desire (in this case, it's the same website you're in).
Go to Blocks and write this same code. Here what we're saying is, that Whenever our current screen (Screen1 in this case) loads up, we want the webviewer to load the url defined in the text string (pink box)
Yeah, if you test your project your website will be loaded as usual. Click here to download demo apk.
The only thing is, when your press the back button, instead of going to the previous webpage, it will exit the app. Let's handle the back press event now
Write this code. Here we are saying that whenever Back button will be pressed, we will check that whether our webviewer can go a step back or not (if user had clicked on some links, then it can), if yes, then we're instructing our webviewer to go to the previous URL.
That's all, we have finally created our Android app.
Useful Links
0 comments:
Post a Comment