Why should I escape from phonegap? Transfer

Source: Internet
Author: User

Why should I escape from phonegap?
 
Abstract: Every programmer has his own technical belief, and I am no exception. But what do you do when technical beliefs encounter problems in your work? I still remember this problem when I first came into contact with HTML5 for cross-platform development.
I am a mobile app developer, from Java-based Android to objective-C-based iOS and finally to HTML5-based cross-platform development, I have spent more than five years, and I have grown from a bottom-Layer Code farm to a project owner.
Every programmer has his own technical belief, and I am no exception. But what do you do when technical beliefs encounter problems in your work? I still remember this problem when I first came into contact with HTML5 for cross-platform development. At the beginning, the company decided to use phonegap as the core framework. However, in subsequent work, it gradually felt that phonegap did not perform well in the project. Project R & D 1. Support terminal platform
On the surface, phonegap supports the most platforms. However, in the actual development process, no matter which platform is used for development, apart from the extended objects encapsulated by the platform, it is impossible to fully run on multiple platforms without complying with W3C standards, therefore, cross-platform implementation is unrealistic, but it still needs to be implemented for different platforms. 2. Development Environment
In the process of application development, the development environment is crucial, but phonegap does not have its own IDE development environment, some open third-party HTML editing software is officially recommended (the third-party editor cannot express the JS extensions made by phonegap ).
For developers, phonegap development is not simply HTML + CSS + Javascript development. To develop phonegap, developers must download the development environments provided by the above seven platform vendors, IDE and so on (this phonegap official website has a description). After the environment is set up, you can perform simulated debugging. For Web developers who have no experience with mobile phone development, you also need to learn new things, the entry threshold is too high, and the Development difficulty is undoubtedly increased.




3. Package and deploy
People who have worked in Application Development know that different sdks must be developed based on the development environment. Therefore, the deployment steps of the packaging department are cumbersome and each platform must be operated in different environments. Recently launched online packaging, but you need to pay for it. 4. Application Implementation
When implementing an application, you must reference a JS package on the webpage to develop an application using phonegap to use a local extension object. Too many JS package references (such as referencing JQ again) will increase the engine burden, thus affecting application performance and user experience. All UIS rely entirely on HTML and CSS. In addition, the IFRAME of WebKit on the mobile phone does not support the height attribute, and the CSS style does not support attributes such as Z-index, position, and overflow, that is, the area of the page cannot be rolled in the normal webpage layout. It can only rely on JS or native UI. Unfortunately, phonegap left this issue to our developers. developers can only select Js. JS on Page scrolling is quite inefficient, especially on Android mid-and low-end mobile phones. User Experience
User Experience is the reason why every application can survive, be accepted by users, and be used for a long time. Here I mainly analyze the issue of the phonegap engine: 1. Platform Stability
From the source code published by phonegap and some application experiences developed using phonegap, phonegap has not undergone complete and systematic testing, or has not adapted its models, there are still many bugs, and many applications have restrictions on the version of the mobile phone platform.
In addition, because of the open source, developers are constantly submitting code. The compatibility between platforms and different versions of the same platform is becoming more and more compatible in the Development of phonegap. The most obvious problem on the UI is that the page is enlarged. The WebKit of the Android platform performs 0.75-operations on the webpage based on the resolution, density, and size of the screen of the mobile phone device ~ 1.5 times the zoom to adapt to the screen. This means that, without changing the WebKit scaling ratio, if the webpage writes width: 10px;, it may actually change to 10*1.5. At the same time, in the page with an input box, once the input box is selected, the page will immediately appear again

 

 


The UI effect that the user sees is different from what the developer wants. 2. Adaptation to terminals of domestic manufacturers
Phonegap has many incomplete functions. For example, when GPS, GPRS, Wi-Fi, and network-based location settings are disabled (WiFi is connected at this time), the location cannot be obtained, mobile phones of mobile phone manufacturers in China often crash or run incorrectly, so the user experience is poor. 3. Multi-Window and animation freezing are not supported
On the overall UI, there is only one window from start to end during the phonegap development process, that is, all webpages are running in this window, such as window switching and excessive animation effects, javaScript and css3 can be used to achieve some animation effects, with low efficiency and limited to the current webpage. At least this is the case before some hardware devices have been installed, in addition, there are a wide variety of terminal devices and vendors except iOS, which makes it more difficult to ensure that the applications can run well on various platforms, so the user experience is poor. 4. UI delay effect, easy to crash
From the code architecture of phonegap open source, the mechanism of phonegap itself will lead to a certain latency on the UI. This problem is inevitable without changing the existing architecture. For example, the speed of the sensor is obviously too slow, and the callback time is too long after the Camera opens the camera. These are the results of very simple web pages. Because phonegap is based on the open-source policy architecture (which facilitates developers to expand their functions) and has done a lot of work on the JS layer, no matter on iPhone or Android, phonegap development does not follow the JS Extension Method specific to its own platform. Instead, it uses thread sleep, browser timer pause, and other methods to obtain callback, which directly leads to latency. In addition, for example, the camera interface, phonegap returned to the user is not a string similar to the file storage address, but to convert the photo to binary and send it to the user, resulting in resource-consuming operations, in addition, it takes a long time. When the image size is large, the application may crash due to an outofmemorysize exception. These problems may not be mentioned in your team, but they are especially prominent in a team with less resources. In addition, all the details in the process of application development can not be ignored, the pursuit of perfect applications should start from the details. Although phonegap can develop many cross-platform applications, developers, especially Project Coordinator, must think twice before selecting a framework.

Why should I escape from phonegap? Transfer

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.