by Jeffrey Walker | Dec 17, 2013
To keep up with the enormous influence and demand of mobile technologies, business leaders today need tools that can create quick and agile applications at the speed of the market. Mobile Application Development Platforms, otherwise known as MADPs, provide this value by offering the capabilities of “write once, run everywhere.” The ability to deploy applications from a single code base across multiple devices and operating systems translates into considerable cost savings for organizations. Let’s continue then where we left off in the last segment by turning now to PhoneGap and finding out more about what it is, how it works, and what value it can offer the business leader in today’s competitive digital marketplace.
PhoneGap
In our recent series on mobile application development approaches, strategies, and best practices we discussed at some length the differences between HTML5, Native, and Hybrid. We learned that HTML5 and Native are really two ends of the spectrum and that Hybrid really amounts to the mixing of both these technologies. This is important because Hybrid applications are really the basis for the technology that is embedded in MADPs like PhoneGap. One writer has described this point as follows: “The real secret sauce of hybrid apps is the implementation of an abstraction layer that exposes the device capabilities (read: native APIs) to the hybrid app as a JavaScript API.” The value of a platform like Adobe’s PhoneGap is that it provides an efficient way to leverage the Native features of a smartphone by developing a web-to-native abstraction layer comprised of a set of JavaScript APIs. Before proceeding, it’s worthwhile to take a closer look at how the PhoneGap infrastructure basically works.
Webviews are used in the native environment to display HTML content. For example, iOS uses a web view control class called UIWebView to present HTML, CSS, or JavaScript content in the Native application. In Android systems this class is called WebView. The native app is also able to assynchronously communicate with JavaScript that runs inside of this Webview. The way that PhoneGap works is that it creates a web to native abstraction layer, or a wrapper, which consists of a set of JavaScript APIs that are able to send and receive messages from the native code in the wrapper assynchronously and then display the results in the Webview.To initiate this Webview, you create a UIWebView (or WebView) object, attach it to a window, and send it a request to load the index.html content on the iPhone through the native browser engine, WebKit.
One blogger cleverly illustrates the process this way: “Think of this as a ‘chrome-less’ web browser. It renders HTML content, without the ‘chrome’ or window decoration of a regular web browser. You build your application to take advantage of this space, and you build navigational/interactive/content elements and application chrome into your HTML and CSS based user interface.” So, in a nutshell, PhoneGap works by intercepting URL requests for the UIWebView that is loaded (or “wrapped”) in this Native container environment.
What companies like Adobe’s PhoneGap have done to leverage this UIWebView feature more fully is to develop an abstraction layer comprised of a set of JavaScript APIs. By wrapping together a set of these JavaScript APIs, PhoneGap provides the ability to access Native APIs across the spectrum of different devices, which leads to the “write once, run everywhere” concept.
Please join us in Part 3 as we continue our discussion of PhoneGap, looking at the major features of the tool along with how the development environment is commonly setup.
Category: Articles | Tagged No Comments.
Web & Cloud
Monitoring