2013年8月12日星期一

Pros and Cons of PhoneGap

PhoneGap is a framework which enables cross platform mobile development by using web technologies, JavaScript, HTML5 and CSS, instead of native languages such as Objective-C and Java. The resulting applications are hybrid.
These hybrid apps run inside a “container” (UIWebView on iOS and WebView on Android) and leverage the device’s browser engine to render the HTML and process the JavaScript locally. Webkit is the browser engine that is used on iOS, Android and BlackBerry. IE powers the browser in Windows Phone devices.
There are two components to PhoneGap:
  1. A JavaScript API which is the interface between the native functionality, such as camera, geolocation and contacts, and the HTML5/CSS code.
  2. Native code which is invoked by the JavaScript APIs.

PhoneGap Pros

PhoneGap is an excellent solution in a number of situations:
  1. Multiple Platforms: Since the front end of the application is built using web technologies, a PhoneGap application with the exact same source code can be deployed across different platforms.
  2. Access basic native functionality: If the application requires minimal access to the native APIs such as camera, geolocation and contacts PhoneGap allows access to these APIs with just a few lines of JavaScript code.
  3. Offline usage: Although the app is built using web technologies, it can still provide offline functionality and has access to the browser’s local cache.

PhoneGap Cons

Since the front end of the application is built in JavaScript, it causes a number of limitations.
  1. Data Processing: Native languages are much faster than JavaScript for data processing on the device.
  2. Background Processing: A large number of applications rely on background threads to provide a smooth user experience: calculating the GPS positions in the background, for example. PhoneGap APIs are built using JavaScript which is not multi-threaded and hence do not support background processing.
  3. Access advanced native functionality: A number of native APIs are not yet supported by PhoneGap’s APIs.
  4. Complex Business Logic: A number of applications such as enterprise applications are quite complex. In this scenario it is simply better to have a certain amount of native code.
  5. Advanced Graphics: Apps that use advanced graphics which can only be accessed using third-party libraries are best done natively.

没有评论:

发表评论