HTML5 has a lot of new features to look forward to. One of the advantages of HTML5 is that it enables cross-platform game coding porting, and many companies are now using HTML5 technology on mobile devices. With the continuous enhancement of HTML5 cross-platform support and the rapid development of smartphones, HTML5 technology has a very good prospect, even some people pre- Speech HTML5 will ignite the new revolution of mobile platform game development . More and more developers are keen to use Html5+javascript to develop mobile web apps. However, the advent of HTML5 Web apps can replace mobile apps in the future, and for now, is still unknown. On the one hand, users in the use of habits, do not like to enter a complex web browser URL, on the other hand, the HTML5 Web App is stored on the server side, the need for each use of data transfer, will result in a waste of traffic. Some developers do not want to touch complex Java code, then, what is the way to use HTML5 to develop the application, but also can be easily encapsulated as an apk file it? webview in Android SDK 1. Instantiate the WebView component in an activity: WebView WebView = new WebView (this); 2. Call WebView Loadurl () method, set Wevview to display the Web page: Internet by: Webview.loadurl ("http://www.31358.com"); local file: Webview.loadurl ("File:///android_asset /xx.html "); Local files are stored in: Assets file 3. Call the activity's Setcontentview () method to display the page view 4. Use WebView point link to see a lot of pages later in order to let WebView support fallback function, need to overwrite the Activity class onkeydown () method, if do not do any processing, click the system fallback shear key, the entire browser will call finish () and end itself, Instead of going back to the previous page 5. You need to add permissions to the Androidmanifest.xml file, or a Web page not available error will occur. <uses-permission android:name= "Android.permission.INTERNET"/> disadvantage: If you are loading a normal web page, there is noWhat is the problem, but if it is HTML5, after encapsulation, in android2.3 above to normal access, android2.2 and below, the SDK WebView has not fully supported HTML5 the following is a concrete example: package Com.android.webview.activity;import Android.app.activity;import Android.os.bundle;import Android.view.keyevent;import Android.webkit.webview;public class Mainactivity extends Activity {private WebView WebView; @Overridepublic void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);// Instantiate the WebView object WebView = new WebView (this);//Set the WebView property, Ability to execute JavaScript script webview.getsettings (). Setjavascriptenabled (true);//load the page that needs to be displayed Webview.loadurl ("http:// www.31358.cn/");//Set Web View Setcontentview (webview);} @Override//Set fallback/overwrite the activity class's onkeydown (int keycoder,keyevent Event) method public boolean onKeyDown (int keycode, keyevent event) {if (keycode = = keyevent.keycode_back) && webview. CanGoBack ()) {webview.goback ();//goback () indicates return of the previous page of WebView return True;}return false;} Add permissions in Androidmanifest.xml file <? XML version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/rEs/android "package=" com.android.webview.activity "android:versioncode=" 1 "android:versionname=" 1.0 ">< USES-SDK android:minsdkversion= "/><application android:icon=" @drawable/icon "android:label=" @string/app_ Name "><activity android:name=". Mainactivity "android:label=" @string/app_name "><intent-filter><action android:name=" Android.intent.action.MAIN "/><category android:name=" Android.intent.category.LAUNCHER "/></ Intent-filter></activity></application><uses-permission android:name= " Android.permission.INTERNET "/></manifest> II, using phonegap PhoneGap is a use based on html,css and JavaScript, Create a fast development platform for mobile cross-platform mobile applications. It enables developers to take advantage of the core features of Iphone,android,palm,symbian,wp7,bada and BlackBerry smartphones-including geolocation, accelerators, contacts, sounds and vibrations, In addition, PHONEGAP has a rich plug-in that can extend unlimited functionality. PhoneGap is free, but it requires additional software from a specific platform, such as the, advantages of the iphone sdk,android Android SDK: Add SDK to eclipse, programming freedom, perfect fit for different device screen sizes , suitable for master use. Cons: Not using layouts, loading pages directly, can't add ads . three, using Rexsee online generation Rexsee is an open source Android development platform that supports developers to standardize the webDevelopment mode, using HTML5, CSS3, JavaScript to quickly implement mobile applications. HTML will be Android. All you have to do is upload the good HTML5 app to the Rexsee server, and soon it will compile into the standard apk installation file . Advantages: One-click Generation, suitable for common use disadvantage: direct encapsulation, unable to add ads . IV, Appmobi HTML5 XDK online generation (using the PhoneGap plugin)
- Push and push family www.tuituizu.com, free admission to scenic spots.
- Travel Network www.jieberu.com.
Several ways to encapsulate HTML5 as an Android app apk file (GO)