Mobile native + HTML5 mashups

Source: Internet
Author: User
Document directory
  • Solution 1:
  • Solution 2:
  • Solution 3:

When it comes to HTML5 development in the mobile field, the most respected estimation is the cross-platform and low threshold. At the same time, to achieve the same effect as native apps, we must have both native features. titainium and phonegap are two typical examples.

The following describes my development experiences and several solutions I have tried in the recent period:

Solution 1:

I started to use phonegap + JQ mobile. The interfaces and effects are all supported by JS. The biggest feeling is that the UI interface latency cannot be tolerated. However, if it is only published as a local website, so everything can be tolerated, because the user's requirements for apps and web pages are never the same, but this is not the case with phonegap.
Advantages of phonegap:
1. Based on JS and HTML5, there is no threshold
2. cross-platform. This is nonsense.
3, none
Disadvantages of phonegap:
1. Great UI latency
2. Compatibility. For example, in the Android version of Web SQL database, localstorage is used to simulate the database.
3. The question of webview resource occupation will be taken into consideration by the Apache Foundation later.

One sentence: Private browsers

Solution 2:

After finishing a project, I started to adopt another solution titainium.
Titainium uses js to write applications, and JS complies with some commonjs specifications. The general principle is: Android or ios api --> titanium API --> JS assembly.

Advantages of titanium:
1. JS, as a glue layer, is easy to get started. After version 1.8, the V8 engine is introduced, which greatly improves the performance. It provides better support for the latest JS specifications, and some foreach methods can be called.
2. Various components are based on native, so the performance and UI performance can be different from those of phonegap.
3. For some cross-platform platforms, you still need to modify some code to switch the platform.
4. comprehensive documentation and clear classification.
Disadvantages of titanium:
1, big! It is limited to the running mechanism of tianium. This problem is not solved for the time being. At the same time, because of the introduction of the V8 engine, If no code is written, the APK file generated by compilation should be at least 5 MB.
2. Document quality needs to be controlled. Some documents are simply incorrect.
3. Titanium has many APIs because the APIs of the two platforms are re-encapsulated. However, because a new layer is added in the middle, it is quite troublesome to call some native features. Although you can write the module by yourself, titanium cannot keep up with the Android version. Therefore, it is quite painful to start from the environment. One problem I encountered: Some Samsung models Castrated the Google map service, so I want to switch to Baidu map, Baidu has an API, so I decided to create a module. However, from the establishment of the titanium module development environment to the start of writing the module, it was not successful for one day. Official documents are purely built up, and it seems that the actual situation is not taken into account at all. The module was a very good feature [highlight], but I don't know what to consider. It was officially weakened. Is it related to their charging policies? Finally, the map problem is solved using the JS version map + webview. At this time, I found that IOS is better, and titanium is more suitable for IOS.
4. Fewer users are used, and some bugs are basically unsolved.
5. There are a lot of resource usage. In my me722, I opened a dozen windows and hung up (this is not wise, I just tested it). I switched to view, the latency of more than 20 is obvious, and the data stack can barely meet the requirements.

One sentence: prototype weapon.

Solution 3:

Native app + web content. Write a shell by yourself. The tab or header at the bottom is fixed and the shell is customized. To avoid the huge JQ, jqmobile, or jqmobi, I can only write a small library for processing. Using the idea of jqmobile, animation is implemented with CSS, however, the CSS animation effect of android2.2 is not satisfactory. In addition, the biggest problem is that the interaction between Shell and content may be complicated. This is a solution that is very close to phonegap. However, compared with phonegap, this customization capability is more powerful and has some headaches (such as the issue of the scroll bar in the dynamically generated page) you can use other solutions (such as webview splitting.

To sum up one sentence: yugong Yishan.

 

The above are three solutions for Web developers. In general, the implementation is relatively simple, and phonegap can be quickly migrated to mobile websites. However, the testing workload can be said to multiply, the new version has a short cycle, and the upgrade is fast. The bug generation speed is estimated to offset the bug elimination speed.
However, JavaScript and HTML5 are not powerful enough in the mobile field, and they lack killer applications. One sentence: "it is unwise to make Web apps the same as native apps ". Web apps should look like Web apps, and native apps should look like native apps, although I cannot tell you exactly what they should look like.
So under what circumstances should we use the HTML5 scheme and when should we use the native scheme.
In another sentence: "It depends", if the product can endure the delay of UI and click and the strange display of components, most of them are Content acquisition without involving too much interaction, and phonegap is fully qualified. Titanium can be competent if you need native speed and display, and the function is moderate without considering the volume. If it is between the two, you can make your own shell. The previous "if" is based on a premise that "the team is not ready or has enough manpower". If you really want to make a good application, at least at this stage, let's start with native.

 

For more information, see http://www.cnblogs.com/xesam /]
Address: http://www.cnblogs.com/xesam/archive/2012/04/26/2471544.html

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.