-
-
Save smallnest/bc4111f1461e3dd5814525e433d763aa to your computer and use it in GitHub Desktop.
Convert HTML5 into standalone Android App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ref. http://stackoverflow.com/questions/12840977/convert-html5-into-standalone-android-app | |
//Ref. http://gamedev.stackexchange.com/questions/8599/packaging-html5-games-as-applications-for-iphone-android | |
//1. Create an Android app using Eclipse. | |
//2. Create a layout that has a <WebView> control. | |
public class WebApp extends Activity { | |
protected void onCreate(Bundle savedInstanceState) { | |
WebView wv = new WebView(this); | |
wv.loadUrl("http://www.myapp.com/"); | |
setContentView(wv); | |
} | |
} | |
//3. Move your HTML code to /assets folder. | |
//4. Load webview with your file:///android_asset/ file. | |
//5. Don't forget to enable JavaScript: | |
WebSettings webSettings = w.getSettings(); | |
webSettings.setJavaScriptEnabled(true); | |
//Additional Readings: | |
//1. http://jster.net/blog/tools-to-package-your-html5-app-for-mobile-devices | |
//2. http://www.zdnet.com/article/heres-why-html-based-apps-dont-work/ | |
//3. http://www.joshmorony.com/building-html5-games-for-mobile-with-cocoon-js/ [CocoonJs documnetation is poor. Warning!] | |
//Notes about PhoneGap | |
// 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. – |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment