Convert HTML5 into standalone Android App
Asked Answered
P

3

67

I have a dynamic HTML5 document that does not contain any external resources (no images, css and scripts are coded inside of document). This HTML5 application is working fine with internet browser. I was wondering, if it would be possible to convert this HTML5 application into standalone Android application, so it can be executed directly without browser. Please advise.

Pompadour answered 11/10, 2012 at 13:43 Comment(3)
Don't forget that even if you put this html5 in a webview and pack it as an app, it still won't be as fluid, fast, dynamic, responsive as a native application.Paff
I understand your point, I'm just saying as a heads-up cause I work in a place (I should really get back to work instead of being on stackoverflow) that do native iOS, native Android and HTML5->to mobile and there's no comparison on the quality of final result.Paff
I disagree. I am using m-gwt.com and have at least at new IOs and new Android Devices no performance issues.Deviled
F
114

Create an Android app using Eclipse.

Create a layout that has a <WebView> control.

Move your HTML code to /assets folder.

Load webview with your file:///android_asset/ file.

And you have an android app!

Falgoust answered 11/10, 2012 at 13:46 Comment(8)
Can this be done if i have images as well? along with some sample java code to be shown with syntax highlighting?Colunga
Now all web apps are head-ache free. Thanks :) I have one question in terms of updates. Each time we do an update on Web-app, which reflects pretty fast. So if I want to deliver an update to mobile app users, how to go about in this method?Raveaux
Don't forget to enable JavaScript: WebSettings webSettings = w.getSettings(); webSettings.setJavaScriptEnabled(true);Pastorship
Does localStorage work when creating a webview app like this? My entire project relies on that, so I wouldn't want to start it only to find out later that it's not possible.Champ
I'm not sure as I don't know much. But it should basically support everything that a android's WebView supports. You can read the documentation here - developer.android.com/reference/android/webkit/WebView.htmlFalgoust
isn't it possible with android studio?Incidence
@GnanaduraiA Yes it's definitely possible.Falgoust
Show! But have any way to compile to iOS? Is same mode?Bite
B
20

Edit:

PhoneGap has now been discontinued.

Original answer:

You could use PhoneGap.

http://phonegap.com/

http://docs.phonegap.com/en/2.1.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

This has the benefit of being a cross-platform solution. Be warned though that you may need to pay subscription fees. The simplest solution is to just embed a WebView as detailed in @Enigma's answer.

Buddha answered 11/10, 2012 at 13:47 Comment(5)
Would you mind if I ask for some guidelines AFTER the documentation link you posted? I mean, that guide teaches how to build the application. Period. But how would this application be effectively become an Android app, for example, ready to be uploaded to Google Play. Does PhoneGAP covers that part too?Joeyjoffre
I haven't built a PhoneGap app so I don't know. I'm sure you can find the information on their website.Buddha
Any other alternatives? I'm not looking for something complex like Titanium, mainly because I don't like JavaScript to muchJoeyjoffre
@Enigma's answer offers the simplest solution.Buddha
PhoneGap sounds/seems good for web developers who want to have native apps out of the HTML5 web app, but at the end there is a catch. In the beginning everything is said to be open source and free at the end it asks for subscription fees to add apps to store. There is a free option with hell lot of restrictions.Clute
O
0

You can use https://appery.io/ It is the same phonegap but in very convinient wrapper

Oxidase answered 8/10, 2015 at 7:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.