PhoneGap Explained Visually
Join the DZone community and get the full member experience.Join For Free
i’ve been “out and about” lately, attending tech conferences, meetup groups, and meeting with developers in their offices, and i am getting great feedback on mobile development & phonegap. there are some common questions that i am often asked, and i hope this post helps everyone understand phonegap better.
phonegap user interface
think of this as a “headless” 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 & css based user interface.
the web view used by phonegap is the same web view used by the native operating system. on ios, this is the objective-c uiwebview class; on android, this is android.webkit.webview. since there are differences in the web view rendering engines between operating systems, make sure that you account for this in your ui implementation.
you can read about the phonegap api and all of the native functionality it exposes at docs.phonegap.com .
phonegap application packaging & distribution
for ios applications the output is an ipa file (ios application archive), for android applications the output is an apk file (android package), for window phone the output is a xap file (application package), etc… these are the same application packaging formats used by “native” applications, and can be distributed through the appropriate ecosystems (itunes store, android market, amazon market, blackberry app world, windows phone marketplace, etc…)
phonegap high-level application architecture
specific application architectures are going to differ on a case-by-case basis, however most data-driven applications employ the following basic architecture. the phonegap application acts as a client for the user to interact with. the phonegap client communicates with an application server to receive data. the application server handles business logic and communicates with a back-end data repository.
the application server is normally a web server (apache, iis, etc…) and has a server side scripting language such as coldfusion, java, .net, php, etc… phonegap is agnostic of back-end technologies and can work with any application server using standard web protocols. the application server performs business logic and calculations, and generally retrieves or persists data from a separate data repository – this is normally a relational database, but could be any structure or mechanism for data persistence.
phonegap applications generally do not talk directly to a database; communication is routed through an application server. the client to application server communication can be based upon standard http requests for html content, rest -ful xml services, json services, or soap (or websockets if your os supports it). these are the exact same techniques that you would use in an desktop-browser based ajax application.
multi-page client-side application architectures are supported, but are not recommended because you lose in-memory variables when loading a separate page.
Published at DZone with permission of Andrew Trice, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.