Working Principle and architecture of phonegap

Source: Internet
Author: User

The development of mobile technology is a tragedy for developers. The development of applications must take into account the frameworks and development languages of different platforms, such as iPhone, Android, and Windows Mobile.

Based on the standard Web technology, phonegap builds a communication bridge between web applications and devices, encapsulates platform differences between mobile devices, and uniformly uses JavaScript interfaces to access local APIs of devices, providing cross-platform solutions.

Phonegap is a standard open-source framework. It is free to use phonegap to develop mobile applications, either commercial or open-source.

What can phonegap do?

1,Develop mobile device client applications based on WEB technology

Use JavaScript and HTML technologies that you are familiar with, or combine jquery mobile and sencha touch mobile Web UI frameworks to develop cross-platform mobile clients.

2,Use phonegap to access the local API of the device

Provides cross-platform device access capabilities. Some access device functions are listed below.ArticleDetailed usage.

Accelerometer (gravity sensing)

Camera (CAMERA)

Compass)

Contacts (Address Book)

File)

Geolocation)

Media)

Network)

Notification)

Storage (SQLite database storage)

3,Publish yourProgramTo different mobile platforms

Phongap build provides the ability to package Web applications online to various mobile platform clients.CommunityThe sencha touch 2 demo of the open-source project is packaged into an android APK file. The phonegap build package is completed online and provides the download interface:

How does phonegap work?

The phonegap architecture has powerful cross-platform access device capabilities, but its working principle is not mysterious. The following uses the iPhone and Android platforms as examples for analysis.

The iPhone and Android platforms all have built-in webview components. They have two features:

1,The webview component is essentially a built-in browser for mobile devices.

Webview, a built-in browser, is the basis for the Web Client to be packaged and cost-effective. It is convenient to use HTML5 and css3 page layout. This is the advantage of mobile Web technology over native development.

2,Webview provides two-way communication between Web APIs and local APIs of devices

Phonegap extends and encapsulates webview on different platforms, making webview a powerful browser that can access the local API of the device, therefore, developers can access the local API of the device through javascript in the phonegap framework.

To understand the above two features, refer to the following phonegap communication diagram with the local API of the device. The running status of a mature phonegap client is as follows:

The application runs on the webview component. The application uses phonegap to expand on various platforms. The application finally accesses the local resources of the device.

Link: http://www.html5mobi.com/discussion/164/phonegap

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.